Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:09:39

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QTEXTBROWSER_H
0005 #define QTEXTBROWSER_H
0006 
0007 #include <QtWidgets/qtwidgetsglobal.h>
0008 #include <QtWidgets/qtextedit.h>
0009 #include <QtCore/qurl.h>
0010 
0011 QT_REQUIRE_CONFIG(textbrowser);
0012 
0013 QT_BEGIN_NAMESPACE
0014 
0015 class QTextBrowserPrivate;
0016 
0017 class Q_WIDGETS_EXPORT QTextBrowser : public QTextEdit
0018 {
0019     Q_OBJECT
0020 
0021     Q_PROPERTY(QUrl source READ source WRITE setSource)
0022     Q_PROPERTY(QTextDocument::ResourceType sourceType READ sourceType)
0023     Q_OVERRIDE(bool modified SCRIPTABLE false)
0024     Q_OVERRIDE(bool readOnly DESIGNABLE false SCRIPTABLE false)
0025     Q_OVERRIDE(bool undoRedoEnabled DESIGNABLE false SCRIPTABLE false)
0026     Q_PROPERTY(QStringList searchPaths READ searchPaths WRITE setSearchPaths)
0027     Q_PROPERTY(bool openExternalLinks READ openExternalLinks WRITE setOpenExternalLinks)
0028     Q_PROPERTY(bool openLinks READ openLinks WRITE setOpenLinks)
0029 
0030 public:
0031     explicit QTextBrowser(QWidget* parent = nullptr);
0032     virtual ~QTextBrowser();
0033 
0034     QUrl source() const;
0035     QTextDocument::ResourceType sourceType() const;
0036 
0037     QStringList searchPaths() const;
0038     void setSearchPaths(const QStringList &paths);
0039 
0040     virtual QVariant loadResource(int type, const QUrl &name) override;
0041 
0042     bool isBackwardAvailable() const;
0043     bool isForwardAvailable() const;
0044     void clearHistory();
0045     QString historyTitle(int) const;
0046     QUrl historyUrl(int) const;
0047     int backwardHistoryCount() const;
0048     int forwardHistoryCount() const;
0049 
0050     bool openExternalLinks() const;
0051     void setOpenExternalLinks(bool open);
0052 
0053     bool openLinks() const;
0054     void setOpenLinks(bool open);
0055 
0056 public Q_SLOTS:
0057     void setSource(const QUrl &name, QTextDocument::ResourceType type = QTextDocument::UnknownResource);
0058     virtual void backward();
0059     virtual void forward();
0060     virtual void home();
0061     virtual void reload();
0062 
0063 Q_SIGNALS:
0064     void backwardAvailable(bool);
0065     void forwardAvailable(bool);
0066     void historyChanged();
0067     void sourceChanged(const QUrl &);
0068     void highlighted(const QUrl &);
0069     void anchorClicked(const QUrl &);
0070 
0071 protected:
0072     bool event(QEvent *e) override;
0073     virtual void keyPressEvent(QKeyEvent *ev) override;
0074     virtual void mouseMoveEvent(QMouseEvent *ev) override;
0075     virtual void mousePressEvent(QMouseEvent *ev) override;
0076     virtual void mouseReleaseEvent(QMouseEvent *ev) override;
0077     virtual void focusOutEvent(QFocusEvent *ev) override;
0078     virtual bool focusNextPrevChild(bool next) override;
0079     virtual void paintEvent(QPaintEvent *e) override;
0080     virtual void doSetSource(const QUrl &name, QTextDocument::ResourceType type = QTextDocument::UnknownResource);
0081 
0082 private:
0083     Q_DISABLE_COPY(QTextBrowser)
0084     Q_DECLARE_PRIVATE(QTextBrowser)
0085 };
0086 
0087 QT_END_NAMESPACE
0088 
0089 #endif // QTEXTBROWSER_H