QGIS API Documentation  3.27.0-Master (0e23467727)
Public Slots | Signals | Public Member Functions | Protected Member Functions | List of all members
QgsRichTextEditor Class Reference

A widget for editing rich text documents, with support for user controlled formatting of text and insertion of hyperlinks and images. More...

#include <qgsrichtexteditor.h>

Inheritance diagram for QgsRichTextEditor:
Inheritance graph
[legend]

Public Slots

void clearSource ()
 Clears the current text from the widget. More...
 
void setText (const QString &text)
 Sets the text to show in the widget. More...
 

Signals

void textChanged ()
 Emitted when the text contents are changed. More...
 

Public Member Functions

 QgsRichTextEditor (QWidget *parent=nullptr)
 Constructor for QgsRichTextEditor, with the specified parent widget. More...
 
QTextDocument * document ()
 Returns a reference to the QTextDocument shown in the widget. More...
 
void setTextCursor (const QTextCursor &cursor)
 Sets the current text cursor. More...
 
QTextCursor textCursor () const
 Returns a reference to the text cursor. More...
 
QString toHtml () const
 Returns the widget's content as a HTML string. More...
 
QString toPlainText () const
 Returns the widget's content as a plain text string. More...
 

Protected Member Functions

void focusInEvent (QFocusEvent *event) override
 

Detailed Description

A widget for editing rich text documents, with support for user controlled formatting of text and insertion of hyperlinks and images.

QgsRichTextEditor provides a reusable widget for allowing users to edit rich text documents, and retrieving and setting the documents via HTML formatted strings.

Since
QGIS 3.20

Definition at line 58 of file qgsrichtexteditor.h.

Constructor & Destructor Documentation

◆ QgsRichTextEditor()

QgsRichTextEditor::QgsRichTextEditor ( QWidget *  parent = nullptr)

Constructor for QgsRichTextEditor, with the specified parent widget.

Definition at line 52 of file qgsrichtexteditor.cpp.

Member Function Documentation

◆ clearSource

void QgsRichTextEditor::clearSource ( )
slot

Clears the current text from the widget.

Definition at line 286 of file qgsrichtexteditor.cpp.

◆ document()

QTextDocument* QgsRichTextEditor::document ( )
inline

Returns a reference to the QTextDocument shown in the widget.

Definition at line 85 of file qgsrichtexteditor.h.

◆ focusInEvent()

void QgsRichTextEditor::focusInEvent ( QFocusEvent *  event)
overrideprotected

Definition at line 329 of file qgsrichtexteditor.cpp.

◆ setText

void QgsRichTextEditor::setText ( const QString &  text)
slot

Sets the text to show in the widget.

The text can either be a plain text string or a HTML document.

Definition at line 686 of file qgsrichtexteditor.cpp.

◆ setTextCursor()

void QgsRichTextEditor::setTextCursor ( const QTextCursor &  cursor)
inline

Sets the current text cursor.

See also
textCursor()

Definition at line 99 of file qgsrichtexteditor.h.

◆ textChanged

void QgsRichTextEditor::textChanged ( )
signal

Emitted when the text contents are changed.

Since
QGIS 3.26

◆ textCursor()

QTextCursor QgsRichTextEditor::textCursor ( ) const
inline

Returns a reference to the text cursor.

See also
setTextCursor()

Definition at line 92 of file qgsrichtexteditor.h.

◆ toHtml()

QString QgsRichTextEditor::toHtml ( ) const

Returns the widget's content as a HTML string.

See also
toPlainText()

Definition at line 237 of file qgsrichtexteditor.cpp.

◆ toPlainText()

QString QgsRichTextEditor::toPlainText ( ) const

Returns the widget's content as a plain text string.

See also
toHtml()

Definition at line 222 of file qgsrichtexteditor.cpp.


The documentation for this class was generated from the following files: