CopperSpice API  1.9.2
QTextBrowser Class Reference

The QTextBrowser class provides a rich text browser with hypertext navigation. More...

Inheritance diagram for QTextBrowser:
QTextEdit QAbstractScrollArea QFrame QWidget QObject QPaintDevice

Public Signals

void anchorClicked (const QUrl &url)
 
void backwardAvailable (bool available)
 
void forwardAvailable (bool available)
 
void highlighted (const QString &text)
 
void highlighted (const QUrl &url)
 
void historyChanged ()
 
void sourceChanged (const QUrl &url)
 
- Public Signals inherited from QTextEdit
void copyAvailable (bool status)
 
void currentCharFormatChanged (const QTextCharFormat &format)
 
void cursorPositionChanged ()
 
void redoAvailable (bool status)
 
void selectionChanged ()
 
void textChanged ()
 
void undoAvailable (bool status)
 
- Public Signals inherited from QWidget
void customContextMenuRequested (const QPoint &pos)
 
void windowIconChanged (const QIcon &icon)
 
void windowIconTextChanged (const QString &iconText)
 
void windowTitleChanged (const QString &title)
 
- Public Signals inherited from QObject
void destroyed (QObject *obj=nullptr)
 
void objectNameChanged (const QString &objectName)
 

Public Slots

virtual void backward ()
 
virtual void forward ()
 
virtual void home ()
 
virtual void reload ()
 
virtual void setSource (const QUrl &name)
 
- Public Slots inherited from QTextEdit
void append (const QString &text)
 
void clear ()
 
void copy ()
 
void cut ()
 
void insertHtml (const QString &text)
 
void insertPlainText (const QString &text)
 
void paste ()
 
void redo ()
 
void scrollToAnchor (const QString &name)
 
void selectAll ()
 
void setAlignment (Qt::Alignment align)
 
void setCurrentFont (const QFont &font)
 
void setFontFamily (const QString &fontFamily)
 
void setFontItalic (bool italic)
 
void setFontPointSize (qreal size)
 
void setFontUnderline (bool underline)
 
void setFontWeight (int weight)
 
void setHtml (const QString &text)
 
void setPlainText (const QString &text)
 
void setText (const QString &text)
 
void setTextBackgroundColor (const QColor &color)
 
void setTextColor (const QColor &color)
 
void undo ()
 
void zoomIn (int range=1)
 
void zoomOut (int range=1)
 
- Public Slots inherited from QWidget
bool close ()
 
void hide ()
 
void lower ()
 
void raise ()
 
void repaint ()
 
void setDisabled (bool disable)
 
void setEnabled (bool enable)
 
void setFocus ()
 
void setHidden (bool hidden)
 
void setStyleSheet (const QString &styleSheet)
 
virtual void setVisible (bool visible)
 
void setWindowModified (bool modified)
 
void setWindowTitle (const QString &title)
 
void show ()
 
void showFullScreen ()
 
void showMaximized ()
 
void showMinimized ()
 
void showNormal ()
 
void update ()
 
- Public Slots inherited from QObject
void deleteLater ()
 

Public Methods

 QTextBrowser (QWidget *parent=nullptr)
 
int backwardHistoryCount () const
 
void clearHistory ()
 
int forwardHistoryCount () const
 
QString historyTitle (int index) const
 
QUrl historyUrl (int index) const
 
bool isBackwardAvailable () const
 
bool isForwardAvailable () const
 
QVariant loadResource (int type, const QUrl &name) override
 
bool openExternalLinks () const
 
bool openLinks () const
 
QStringList searchPaths () const
 
void setOpenExternalLinks (bool open)
 
void setOpenLinks (bool open)
 
void setSearchPaths (const QStringList &paths)
 
QUrl source () const
 
- Public Methods inherited from QTextEdit
 QTextEdit (const QString &text, QWidget *parent=nullptr)
 
 QTextEdit (QWidget *parent=nullptr)
 
virtual ~QTextEdit ()
 
bool acceptRichText () const
 
Qt::Alignment alignment () const
 
QString anchorAt (const QPoint &pos) const
 
AutoFormatting autoFormatting () const
 
bool canPaste () const
 
QMenucreateStandardContextMenu ()
 
QMenucreateStandardContextMenu (const QPoint &position)
 
QTextCharFormat currentCharFormat () const
 
QFont currentFont () const
 
QTextCursor cursorForPosition (const QPoint &pos) const
 
QRect cursorRect () const
 
QRect cursorRect (const QTextCursor &cursor) const
 
int cursorWidth () const
 
QTextDocumentdocument () const
 
QString documentTitle () const
 
void ensureCursorVisible ()
 
QList< ExtraSelectionextraSelections () const
 
bool find (const QRegularExpression &exp, QTextDocument::FindFlags options=QTextDocument::FindFlags ())
 
bool find (const QString &exp, QTextDocument::FindFlags options=QTextDocument::FindFlags ())
 
QString fontFamily () const
 
bool fontItalic () const
 
qreal fontPointSize () const
 
bool fontUnderline () const
 
int fontWeight () const
 
QVariant inputMethodQuery (Qt::InputMethodQuery property) const override
 
QVariant inputMethodQuery (Qt::InputMethodQuery query, QVariant argument) const
 
bool isReadOnly () const
 
bool isUndoRedoEnabled () const
 
int lineWrapColumnOrWidth () const
 
LineWrapMode lineWrapMode () const
 
void mergeCurrentCharFormat (const QTextCharFormat &modifier)
 
void moveCursor (QTextCursor::MoveOperation operation, QTextCursor::MoveMode mode=QTextCursor::MoveAnchor)
 
bool overwriteMode () const
 
QString placeholderText () const
 
void print (QPagedPaintDevice *printer) const
 
void setAcceptRichText (bool accept)
 
void setAutoFormatting (AutoFormatting features)
 
void setCurrentCharFormat (const QTextCharFormat &format)
 
void setCursorWidth (int width)
 
void setDocument (QTextDocument *document)
 
void setDocumentTitle (const QString &title)
 
void setExtraSelections (const QList< ExtraSelection > &selections)
 
void setLineWrapColumnOrWidth (int width)
 
void setLineWrapMode (LineWrapMode mode)
 
void setOverwriteMode (bool overwrite)
 
void setPlaceholderText (const QString &placeholderText)
 
void setReadOnly (bool readOnly)
 
void setTabChangesFocus (bool enabled)
 
void setTabStopWidth (int width)
 
void setTextCursor (const QTextCursor &cursor)
 
void setTextInteractionFlags (Qt::TextInteractionFlags flags)
 
void setUndoRedoEnabled (bool enabled)
 
void setWordWrapMode (QTextOption::WrapMode policy)
 
bool tabChangesFocus () const
 
int tabStopWidth () const
 
QColor textBackgroundColor () const
 
QColor textColor () const
 
QTextCursor textCursor () const
 
Qt::TextInteractionFlags textInteractionFlags () const
 
QString toHtml () const
 
QString toPlainText () const
 
QTextOption::WrapMode wordWrapMode () const
 
- Public Methods inherited from QAbstractScrollArea
 QAbstractScrollArea (QWidget *parent=nullptr)
 
 ~QAbstractScrollArea ()
 
void addScrollBarWidget (QWidget *widget, Qt::Alignment alignment)
 
QWidgetcornerWidget () const
 
QScrollBarhorizontalScrollBar () const
 
Qt::ScrollBarPolicy horizontalScrollBarPolicy () const
 
QSize maximumViewportSize () const
 
QSize minimumSizeHint () const override
 
QWidgetList scrollBarWidgets (Qt::Alignment alignment)
 
void setCornerWidget (QWidget *widget)
 
void setHorizontalScrollBar (QScrollBar *scrollBar)
 
void setHorizontalScrollBarPolicy (Qt::ScrollBarPolicy policy)
 
void setSizeAdjustPolicy (SizeAdjustPolicy policy)
 
virtual void setupViewport (QWidget *viewport)
 
void setVerticalScrollBar (QScrollBar *scrollBar)
 
void setVerticalScrollBarPolicy (Qt::ScrollBarPolicy policy)
 
void setViewport (QWidget *widget)
 
SizeAdjustPolicy sizeAdjustPolicy () const
 
QSize sizeHint () const override
 
QScrollBarverticalScrollBar () const
 
Qt::ScrollBarPolicy verticalScrollBarPolicy () const
 
QWidgetviewport () const
 
- Public Methods inherited from QFrame
 QFrame (QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 
 ~QFrame ()
 
QRect frameRect () const
 
Shadow frameShadow () const
 
Shape frameShape () const
 
int frameStyle () const
 
int frameWidth () const
 
int lineWidth () const
 
int midLineWidth () const
 
void setFrameRect (const QRect &rect)
 
void setFrameShadow (Shadow value)
 
void setFrameShape (Shape value)
 
void setFrameStyle (int style)
 
void setLineWidth (int width)
 
void setMidLineWidth (int width)
 
QSize sizeHint () const override
 
- Public Methods inherited from QWidget
 QWidget (QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 
 ~QWidget ()
 
bool acceptDrops () const
 
QString accessibleDescription () const
 
QString accessibleName () const
 
QList< QAction * > actions () const
 
void activateWindow ()
 
void addAction (QAction *action)
 
void addActions (const QList< QAction * > &actions)
 
void adjustSize ()
 
bool autoFillBackground () const
 
QPalette::ColorRole backgroundRole () const
 
QBackingStorebackingStore () const
 
QSize baseSize () const
 
QWidget * childAt (const QPoint &position) const
 
QWidget * childAt (int x, int y) const
 
QRect childrenRect () const
 
QRegion childrenRegion () const
 
void clearFocus ()
 
void clearMask ()
 
QMargins contentsMargins () const
 
QRect contentsRect () const
 
Qt::ContextMenuPolicy contextMenuPolicy () const
 
QCursor cursor () const
 
WId effectiveWinId () const
 
void ensurePolished () const
 
Qt::FocusPolicy focusPolicy () const
 
QWidget * focusProxy () const
 
QWidget * focusWidget () const
 
const QFontfont () const
 
QFontInfo fontInfo () const
 
QFontMetrics fontMetrics () const
 
QPalette::ColorRole foregroundRole () const
 
QRect frameGeometry () const
 
QSize frameSize () const
 
const QRectgeometry () const
 
void getContentsMargins (int *left, int *top, int *right, int *bottom) const
 
QPixmap grab (const QRect &rectangle=QRect (QPoint (0, 0), QSize (-1,-1)))
 
void grabGesture (Qt::GestureType gestureType, Qt::GestureFlags flags=Qt::GestureFlags ())
 
void grabKeyboard ()
 
void grabMouse ()
 
void grabMouse (const QCursor &cursor)
 
int grabShortcut (const QKeySequence &key, Qt::ShortcutContext context=Qt::WindowShortcut)
 
QGraphicsEffectgraphicsEffect () const
 
QGraphicsProxyWidgetgraphicsProxyWidget () const
 
bool hasEditFocus () const
 
bool hasFocus () const
 
virtual bool hasHeightForWidth () const
 
bool hasMouseTracking () const
 
int height () const
 
virtual int heightForWidth (int width) const
 
Qt::InputMethodHints inputMethodHints () const
 
void insertAction (QAction *before, QAction *action)
 
void insertActions (QAction *before, QList< QAction * > actions)
 
bool isActiveWindow () const
 
bool isAncestorOf (const QWidget *child) const
 
bool isEnabled () const
 
bool isEnabledTo (const QWidget *parent) const
 
bool isEnabledToTLW () const
 
bool isFullScreen () const
 
bool isHidden () const
 
bool isMaximized () const
 
bool isMinimized () const
 
bool isModal () const
 
bool isTopLevel () const
 
bool isVisible () const
 
bool isVisibleTo (const QWidget *parent) const
 
bool isWindow () const
 
bool isWindowModified () const
 
QLayoutlayout () const
 
Qt::LayoutDirection layoutDirection () const
 
QLocale locale () const
 
QPoint mapFrom (const QWidget *parent, const QPoint &pos) const
 
QPoint mapFromGlobal (const QPoint &pos) const
 
QPoint mapFromParent (const QPoint &pos) const
 
QPoint mapTo (const QWidget *parent, const QPoint &pos) const
 
QPoint mapToGlobal (const QPoint &pos) const
 
QPoint mapToParent (const QPoint &pos) const
 
QRegion mask () const
 
int maximumHeight () const
 
QSize maximumSize () const
 
int maximumWidth () const
 
int minimumHeight () const
 
QSize minimumSize () const
 
int minimumWidth () const
 
void move (const QPoint &point)
 
void move (int x, int y)
 
QWidget * nativeParentWidget () const
 
QWidget * nextInFocusChain () const
 
QRect normalGeometry () const
 
void overrideWindowFlags (Qt::WindowFlags flags)
 
QPaintEnginepaintEngine () const override
 
const QPalettepalette () const
 
QWidget * parentWidget () const
 
QPoint pos () const
 
QWidget * previousInFocusChain () const
 
QRect rect () const
 
void releaseKeyboard ()
 
void releaseMouse ()
 
void releaseShortcut (int id)
 
void removeAction (QAction *action)
 
void render (QPaintDevice *target, const QPoint &targetOffset=QPoint (), const QRegion &sourceRegion=QRegion (), RenderFlags renderFlags=RenderFlags (DrawWindowBackground|DrawChildren))
 
void render (QPainter *painter, const QPoint &targetOffset=QPoint (), const QRegion &sourceRegion=QRegion (), RenderFlags renderFlags=RenderFlags (DrawWindowBackground|DrawChildren))
 
void repaint (const QRect &rect)
 
void repaint (const QRegion &region)
 
void repaint (int x, int y, int w, int h)
 
void resize (const QSize &size)
 
void resize (int w, int h)
 
bool restoreGeometry (const QByteArray &geometry)
 
QByteArray saveGeometry () const
 
void scroll (int dx, int dy)
 
void scroll (int dx, int dy, const QRect &rect)
 
void setAcceptDrops (bool on)
 
void setAccessibleDescription (const QString &description)
 
void setAccessibleName (const QString &name)
 
void setAttribute (Qt::WidgetAttribute attribute, bool enable=true)
 
void setAutoFillBackground (bool enable)
 
void setBackgroundRole (QPalette::ColorRole role)
 
void setBaseSize (const QSize &size)
 
void setBaseSize (int basew, int baseh)
 
void setContentsMargins (const QMargins &margins)
 
void setContentsMargins (int left, int top, int right, int bottom)
 
void setContextMenuPolicy (Qt::ContextMenuPolicy policy)
 
void setCursor (const QCursor &cursor)
 
void setEditFocus (bool enable)
 
void setFixedHeight (int h)
 
void setFixedSize (const QSize &size)
 
void setFixedSize (int w, int h)
 
void setFixedWidth (int w)
 
void setFocus (Qt::FocusReason reason)
 
void setFocusPolicy (Qt::FocusPolicy policy)
 
void setFocusProxy (QWidget *widget)
 
void setFont (const QFont &font)
 
void setForegroundRole (QPalette::ColorRole role)
 
void setGeometry (const QRect &rect)
 
void setGeometry (int x, int y, int w, int h)
 
void setGraphicsEffect (QGraphicsEffect *effect)
 
void setInputMethodHints (Qt::InputMethodHints hints)
 
void setLayout (QLayout *layout)
 
void setLayoutDirection (Qt::LayoutDirection direction)
 
void setLocale (const QLocale &locale)
 
void setMask (const QBitmap &bitmap)
 
void setMask (const QRegion &region)
 
void setMaximumHeight (int maxh)
 
void setMaximumSize (const QSize &size)
 
void setMaximumSize (int maxw, int maxh)
 
void setMaximumWidth (int maxw)
 
void setMinimumHeight (int minh)
 
void setMinimumSize (const QSize &size)
 
void setMinimumSize (int minw, int minh)
 
void setMinimumWidth (int minw)
 
void setMouseTracking (bool enable)
 
void setPalette (const QPalette &palette)
 
void setParent (QWidget *parent)
 
void setParent (QWidget *parent, Qt::WindowFlags flags)
 
void setShortcutAutoRepeat (int id, bool enable=true)
 
void setShortcutEnabled (int id, bool enable=true)
 
void setSizeIncrement (const QSize &size)
 
void setSizeIncrement (int w, int h)
 
void setSizePolicy (QSizePolicy policy)
 
void setSizePolicy (QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical)
 
void setStatusTip (const QString &data)
 
void setStyle (QStyle *style)
 
void setToolTip (const QString &data)
 
void setToolTipDuration (int msec)
 
void setUpdatesEnabled (bool enable)
 
void setWhatsThis (const QString &str)
 
void setWindowFilePath (const QString &filePath)
 
void setWindowFlags (Qt::WindowFlags flags)
 
void setWindowIcon (const QIcon &icon)
 
void setWindowModality (Qt::WindowModality windowModality)
 
void setWindowOpacity (qreal level)
 
void setWindowRole (const QString &role)
 
void setWindowState (Qt::WindowStates windowState)
 
QSize size () const
 
QSize sizeIncrement () const
 
QSizePolicy sizePolicy () const
 
void stackUnder (QWidget *widget)
 
QString statusTip () const
 
QStylestyle () const
 
QString styleSheet () const
 
bool testAttribute (Qt::WidgetAttribute attribute) const
 
QString toolTip () const
 
int toolTipDuration () const
 
QWidget * topLevelWidget () const
 
bool underMouse () const
 
void ungrabGesture (Qt::GestureType gestureType)
 
void unsetCursor ()
 
void unsetLayoutDirection ()
 
void unsetLocale ()
 
void update (const QRect &rect)
 
void update (const QRegion &region)
 
void update (int x, int y, int w, int h)
 
void updateGeometry ()
 
bool updatesEnabled () const
 
QRegion visibleRegion () const
 
QString whatsThis () const
 
int width () const
 
QWidget * window () const
 
QString windowFilePath () const
 
Qt::WindowFlags windowFlags () const
 
QWindowwindowHandle () const
 
QIcon windowIcon () const
 
Qt::WindowModality windowModality () const
 
qreal windowOpacity () const
 
QString windowRole () const
 
Qt::WindowStates windowState () const
 
QString windowTitle () const
 
Qt::WindowType windowType () const
 
WId winId () const
 
int x () const
 
int y () const
 
- Public Methods inherited from QObject
 QObject (QObject *parent=nullptr)
 
 ~QObject ()
 
bool blockSignals (bool block)
 
const QList< QObject * > & children () const
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QStringdynamicPropertyNames () const
 
virtual bool event (QEvent *event)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
template<typename T >
findChild (const QString &childName=QString ()) const
 
template<class T >
QList< T > findChildren (const QRegularExpression &regExp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<class T >
QList< T > findChildren (const QString &childName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
bool inherits (const QString &className) const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const
 
bool isWindowType () const
 
void killTimer (int id)
 
const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const
 
QObject * parent () const
 
template<class T = QVariant>
property (const QString &name) const
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const QString &name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
QThreadthread () const
 
- Public Methods inherited from QPaintDevice
virtual ~QPaintDevice ()
 
int colorCount () const
 
int depth () const
 
int devicePixelRatio () const
 
qreal devicePixelRatioF () const
 
int height () const
 
int heightMM () const
 
int logicalDpiX () const
 
int logicalDpiY () const
 
bool paintingActive () const
 
int physicalDpiX () const
 
int physicalDpiY () const
 
int width () const
 
int widthMM () const
 

Protected Methods

bool event (QEvent *event) override
 
bool focusNextPrevChild (bool next) override
 
void focusOutEvent (QFocusEvent *event) override
 
void keyPressEvent (QKeyEvent *event) override
 
void mouseMoveEvent (QMouseEvent *event) override
 
void mousePressEvent (QMouseEvent *event) override
 
void mouseReleaseEvent (QMouseEvent *event) override
 
void paintEvent (QPaintEvent *event) override
 
- Protected Methods inherited from QTextEdit
virtual bool canInsertFromMimeData (const QMimeData *source) const
 
void changeEvent (QEvent *event) override
 
void contextMenuEvent (QContextMenuEvent *event) override
 
virtual QMimeDatacreateMimeDataFromSelection () const
 
void dragEnterEvent (QDragEnterEvent *event) override
 
void dragLeaveEvent (QDragLeaveEvent *event) override
 
void dragMoveEvent (QDragMoveEvent *event) override
 
void dropEvent (QDropEvent *event) override
 
bool event (QEvent *event) override
 
void focusInEvent (QFocusEvent *event) override
 
bool focusNextPrevChild (bool next) override
 
void focusOutEvent (QFocusEvent *event) override
 
void inputMethodEvent (QInputMethodEvent *event) override
 
virtual void insertFromMimeData (const QMimeData *source)
 
void keyPressEvent (QKeyEvent *event) override
 
void keyReleaseEvent (QKeyEvent *event) override
 
void mouseDoubleClickEvent (QMouseEvent *event) override
 
void mouseMoveEvent (QMouseEvent *event) override
 
void mousePressEvent (QMouseEvent *event) override
 
void mouseReleaseEvent (QMouseEvent *event) override
 
void paintEvent (QPaintEvent *event) override
 
void resizeEvent (QResizeEvent *event) override
 
void scrollContentsBy (int dx, int dy) override
 
void showEvent (QShowEvent *event) override
 
void wheelEvent (QWheelEvent *event) override
 
- Protected Methods inherited from QAbstractScrollArea
bool event (QEvent *event) override
 
void setViewportMargins (const QMargins &margins)
 
void setViewportMargins (int left, int top, int right, int bottom)
 
virtual bool viewportEvent (QEvent *event)
 
QMargins viewportMargins () const
 
virtual QSize viewportSizeHint () const
 
- Protected Methods inherited from QFrame
void drawFrame (QPainter *painter)
 
bool event (QEvent *event) override
 
void initStyleOption (QStyleOptionFrame *option) const
 
- Protected Methods inherited from QWidget
virtual void actionEvent (QActionEvent *event)
 
virtual void closeEvent (QCloseEvent *event)
 
void create (WId window=0, bool initializeWindow=true, bool destroyOldWindow=true)
 
void destroy (bool destroyWindow=true, bool destroySubWindows=true)
 
virtual void enterEvent (QEvent *event)
 
bool event (QEvent *event) override
 
bool focusNextChild ()
 
bool focusPreviousChild ()
 
virtual void hideEvent (QHideEvent *event)
 
void initPainter (QPainter *painter) const override
 
virtual void leaveEvent (QEvent *event)
 
int metric (PaintDeviceMetric metric) const override
 
virtual void moveEvent (QMoveEvent *event)
 
virtual bool nativeEvent (const QByteArray &eventType, void *message, long *result)
 
virtual void tabletEvent (QTabletEvent *event)
 
- Protected Methods inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signalMethod) const
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signalMethod) const
 
bool isSignalConnected (const QMetaMethod &signalMethod) const
 
int receivers (const QString &signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Protected Methods inherited from QPaintDevice
 QPaintDevice ()
 

Properties

 openExternalLinks
 
 openLinks
 
 readOnly
 
 searchPaths
 
 source
 
 undoRedoEnabled
 
- Properties inherited from QTextEdit
 acceptRichText
 
 autoFormatting
 
 cursorWidth
 
 document
 
 documentTitle
 
 html
 
 lineWrapColumnOrWidth
 
 lineWrapMode
 
 overwriteMode
 
 placeholderText
 
 plainText
 
 readOnly
 
 tabChangesFocus
 
 tabStopWidth
 
 textInteractionFlags
 
 undoRedoEnabled
 
 wordWrapMode
 
- Properties inherited from QAbstractScrollArea
 horizontalScrollBarPolicy
 
 verticalScrollBarPolicy
 
- Properties inherited from QFrame
 frameRect
 
 frameShadow
 
 frameShape
 
 frameWidth
 
 lineWidth
 
 midLineWidth
 
- Properties inherited from QWidget
 acceptDrops
 
 accessibleDescription
 
 accessibleName
 
 autoFillBackground
 
 baseSize
 
 childrenRect
 
 childrenRegion
 
 contextMenuPolicy
 
 cursor
 
 enabled
 
 focus
 
 focusPolicy
 
 font
 
 frameGeometry
 
 frameSize
 
 fullScreen
 
 geometry
 
 height
 
 inputMethodHints
 
 isActiveWindow
 
 layoutDirection
 
 locale
 
 maximized
 
 maximumHeight
 
 maximumSize
 
 maximumWidth
 
 minimized
 
 minimumHeight
 
 minimumSize
 
 minimumSizeHint
 
 minimumWidth
 
 modal
 
 mouseTracking
 
 normalGeometry
 
 palette
 
 pos
 
 rect
 
 size
 
 sizeHint
 
 sizeIncrement
 
 sizePolicy
 
 statusTip
 
 styleSheet
 
 toolTip
 
 updatesEnabled
 
 visible
 
 whatsThis
 
 width
 
 windowFilePath
 
 windowFlags
 
 windowIcon
 
 windowIconText
 
 windowModality
 
 windowModified
 
 windowOpacity
 
 windowTitle
 
 x
 
 y
 
- Properties inherited from QObject
 objectName
 

Additional Inherited Members

- Public Typedefs inherited from QWidget
using RenderFlags = QFlags< RenderFlag >
 
- Public Types inherited from QTextEdit
enum  LineWrapMode
 
- Public Types inherited from QFrame
enum  Shadow
 
enum  Shape
 
enum  StyleMask
 
- Public Types inherited from QWidget
enum  RenderFlag
 
- Public Types inherited from QPaintDevice
enum  PaintDeviceMetric
 
- Static Public Methods inherited from QWidget
static QWidget * createWindowContainer (QWindow *window, QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 
static QWidget * find (WId id)
 
static QWidget * keyboardGrabber ()
 
static QWidget * mouseGrabber ()
 
static void setTabOrder (QWidget *firstWidget, QWidget *secondWidget)
 
- Static Public Methods inherited from QObject
static bool connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ())
 
static bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...))
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod)
 
static QMetaObjectstaticMetaObject ()
 
static QString tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >())
 
- Protected Slots inherited from QWidget
void updateMicroFocus ()
 

Detailed Description

The QTextBrowser class provides a rich text browser with hypertext navigation. This class extends QTextEdit (in read-only mode), adding some navigation functionality so that users can follow links in hypertext documents.

If you want to provide your users with an editable rich text editor, use QTextEdit. If you want a text browser without hypertext navigation use QTextEdit, and use QTextEdit::setReadOnly() to disable editing. If you just need to display a small piece of rich text use QLabel.

Document Source and Contents

The contents of QTextEdit are set with setHtml() or setPlainText(), but QTextBrowser also implements the setSource() function, making it possible to use a named document as the source text. The name is looked up in a list of search paths and in the directory of the current document factory.

If a document name ends with an anchor (for example, "#anchor"), the text browser automatically scrolls to that position (using scrollToAnchor()). When the user clicks on a hyperlink, the browser will call setSource() itself with the link's href value as argument. You can track the current source by connecting to the sourceChanged() signal.

Navigation

QTextBrowser provides backward() and forward() slots which you can use to implement Back and Forward buttons. The home() slot sets the text to the very first document displayed. The anchorClicked() signal is emitted when the user clicks an anchor. To override the default navigation behavior of the browser, call the setSource() function to supply new document text in a slot connected to this signal.

If you want to load documents stored in the CopperSpice Resource System use qrc as the scheme in the URL to load. For example, for the document resource path :/docs/index.html use qrc:/docs/index.html as the URL with setSource(). To access local files, use file as the scheme in the URL.

See also
QTextEdit, QTextDocument

Constructor & Destructor Documentation

QTextBrowser::QTextBrowser ( QWidget parent = nullptr)
explicit

Constructs an empty QTextBrowser with the given parent.

Method Documentation

void QTextBrowser::anchorClicked ( const QUrl url)
signal

This signal is emitted when the user clicks an anchor. The URL referred to by the anchor is passed in url. Note that the browser will automatically handle navigation to the location specified by url unless the openLinks property is set to false or you call setSource() in a slot connected. This mechanism is used to override the default navigation features of the browser.

void QTextBrowser::backward ( )
slot

Changes the document displayed to the previous document in the list of documents built by navigating links. Does nothing if there is no previous document.

See also
forward(), backwardAvailable()
void QTextBrowser::backwardAvailable ( bool  available)
signal

This signal is emitted when the availability of backward() changes. available is false when the user is at home(), otherwise it is true.

int QTextBrowser::backwardHistoryCount ( ) const

Returns the number of locations backward in the history.

void QTextBrowser::clearHistory ( )

Clears the history of visited documents and disables the forward and backward navigation.

See also
backward(), forward()
bool QTextBrowser::event ( QEvent event)
overrideprotected

Reimplemented from QTextEdit::event()

bool QTextBrowser::focusNextPrevChild ( bool  next)
overrideprotectedvirtual

Reimplemented from QWidget::focusNextPrevChild()

void QTextBrowser::focusOutEvent ( QFocusEvent event)
overrideprotectedvirtual

Reimplemented from QWidget::focusOutEvent()

void QTextBrowser::forward ( )
slot

Changes the document displayed to the next document in the list of documents built by navigating links. Does nothing if there is no next document.

See also
backward(), forwardAvailable()
void QTextBrowser::forwardAvailable ( bool  available)
signal

This signal is emitted when the availability of forward() changes. The available flag is true after the user navigates backward() and false when the user navigates or goes forward().

int QTextBrowser::forwardHistoryCount ( ) const

Returns the number of locations forward in the history.

void QTextBrowser::highlighted ( const QString text)
signal

A signal which can pass text to a slot. For example QStatusBar's message().

void QTextBrowser::highlighted ( const QUrl url)
signal

This signal is emitted when the user has selected but not activated an anchor in the document. The URL referred to by the anchor is passed in url.

void QTextBrowser::historyChanged ( )
signal

This signal is emitted when the history changes.

See also
historyTitle(), historyUrl()
QString QTextBrowser::historyTitle ( int  index) const

Returns the documentTitle() of the HistoryItem.

InputReturn
index < 0backward() history
index == 0current, refer to QTextBrowser::source()
index > 0forward() history
backaction.setToolTip(browser.historyTitle(-1));
forwardaction.setToolTip(browser.historyTitle(+1));
QUrl QTextBrowser::historyUrl ( int  index) const

Returns the url of the HistoryItem.

InputReturn
index < 0backward() history
index == 0current, refer to QTextBrowser::source()
index > 0forward() history
void QTextBrowser::home ( )
slot

Changes the document displayed to be the first document from the history.

bool QTextBrowser::isBackwardAvailable ( ) const

Returns true if the text browser can go backward in the document history using backward().

See also
backwardAvailable(), backward()
bool QTextBrowser::isForwardAvailable ( ) const

Returns true if the text browser can go forward in the document history using forward().

See also
forwardAvailable(), forward()
void QTextBrowser::keyPressEvent ( QKeyEvent event)
overrideprotectedvirtual

The event specifies the following keyboard shortcuts.

KeypressAction
Alt+Left Arrowbackward()
Alt+Right Arrowforward()
Alt+Up Arrowhome()

Reimplemented from QAbstractScrollArea::keyPressEvent()

QVariant QTextBrowser::loadResource ( int  type,
const QUrl name 
)
overridevirtual

This method is called when the document is loaded once for each image in the document. The type indicates the kind of resource to be loaded. An invalid QVariant is returned if the resource can not be loaded. The default implementation ignores type and tries to locate the resources by interpreting name as a file name.

If the url is not an absolute path it tries to find the file in the paths of the searchPaths property and in the same directory as the current source. On success the result is a QVariant which stores a QByteArray with the contents of the file.

If you reimplement this method you can return other QVariant types. The table below shows which variant types are supported depending on the resource type.

ResourceTypeQVariant::Type
QTextDocument::HtmlResourceQString or QByteArray
QTextDocument::ImageResourceQImage, QPixmap or QByteArray
QTextDocument::StyleSheetResourceQString or QByteArray

Reimplemented from QTextEdit::loadResource()

void QTextBrowser::mouseMoveEvent ( QMouseEvent event)
overrideprotectedvirtual
void QTextBrowser::mousePressEvent ( QMouseEvent event)
overrideprotectedvirtual
void QTextBrowser::mouseReleaseEvent ( QMouseEvent event)
overrideprotectedvirtual
bool QTextBrowser::openExternalLinks ( ) const

Returns the value of the property.

bool QTextBrowser::openLinks ( ) const

Returns the value of the property.

void QTextBrowser::paintEvent ( QPaintEvent event)
overrideprotectedvirtual
void QTextBrowser::reload ( )
slot

Reloads the current set source.

QStringList QTextBrowser::searchPaths ( ) const

Returns the value of the property.

void QTextBrowser::setOpenExternalLinks ( bool  open)

Sets the value of the property to open.

void QTextBrowser::setOpenLinks ( bool  open)

Sets the value of the property to open.

void QTextBrowser::setSearchPaths ( const QStringList paths)

Sets the value of the property to paths.

void QTextBrowser::setSource ( const QUrl name)
slot

Sets the value of the property to name.

QUrl QTextBrowser::source ( ) const

Returns the value of the property.

void QTextBrowser::sourceChanged ( const QUrl url)
signal

This signal is emitted when the source has changed, url being the new source. Source changes happen both programmatically when calling setSource(), forward(), backward() or home() or when the user clicks on links or presses the equivalent key sequences.

Property Documentation

QTextBrowser::openExternalLinks

Specifies whether QTextBrowser should automatically open links to external sources using QDesktopServices::openUrl() instead of emitting the anchorClicked signal. Links are considered external if their scheme is neither file or qrc.

The default value is false.

PropertiesClass Methods
read openExternalLinks
write setOpenExternalLinks
QTextBrowser::openLinks

This property specifies whether QTextBrowser should automatically open links the user tries to activate by mouse or keyboard. Regardless of the value of this property the anchorClicked signal is always emitted.

The default value is true.

PropertiesClass Methods
read openLinks
write setOpenLinks
QTextBrowser::readOnly

This property holds whether the text browser is read-only.

By default, this property is true.

PropertiesClass Methods
read isReadOnly
write setReadOnly
designable true
scriptable true
QTextBrowser::searchPaths

This property holds the search paths used by the text browser to find supporting content. QTextBrowser uses this list to locate images and documents.

By default this property contains an empty string list.

PropertiesClass Methods
read searchPaths
write setSearchPaths
QTextBrowser::source

This property holds the name of the displayed document. This is an invalid url if no document is displayed or if the source is unknown.

When setting this property QTextBrowser tries to find a document with the specified name in the paths of the searchPaths property and directory of the current source, unless the value is an absolute file path. It also checks for optional anchors and scrolls the document accordingly.

If the first tag in the document is <qt type=detail> the document is displayed as a popup rather than as new document in the browser window itself. Otherwise the document is displayed normally in the text browser with the text set to the contents of the named document with setHtml().

By default this property contains an empty URL.

PropertiesClass Methods
read source
write setSource
QTextBrowser::undoRedoEnabled

This property holds whether the text browser supports undo/redo operations.

By default, this property is false.

PropertiesClass Methods
read isUndoRedoEnabled
write setUndoRedoEnabled
designable true
scriptable true