Class: QgsRichTextEditor

class qgis.gui.QgsRichTextEditor

Bases: PyQt5.QtWidgets.QWidget

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.

New in version 3.20.

QgsRichTextEditor(parent: QWidget = None) Constructor for QgsRichTextEditor, with the specified parent widget.

Methods

actionEvent

changeEvent

childEvent

clearSource

Clears the current text from the widget.

closeEvent

connectNotify

contextMenuEvent

create

customEvent

destroy

disconnectNotify

document

Returns a reference to the QTextDocument shown in the widget.

dragEnterEvent

dragLeaveEvent

dragMoveEvent

dropEvent

enterEvent

event

focusInEvent

param event

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

hideEvent

initPainter

inputMethodEvent

isSignalConnected

keyPressEvent

keyReleaseEvent

leaveEvent

metric

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

mouseReleaseEvent

moveEvent

nativeEvent

paintEvent

receivers

resizeEvent

sender

senderSignalIndex

setText

Sets the text to show in the widget.

setTextCursor

Sets the current text cursor.

sharedPainter

showEvent

tabletEvent

textCursor

Returns a reference to the text cursor.

timerEvent

toHtml

Returns the widget's content as a HTML string.

toPlainText

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

updateMicroFocus

wheelEvent

Signals

textChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

actionEvent(self, QActionEvent)
changeEvent(self, QEvent)
childEvent(self, QChildEvent)
clearSource(self)

Clears the current text from the widget.

closeEvent(self, QCloseEvent)
connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
create(self, window: PyQt5.sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
customEvent(self, QEvent)
destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, QMetaMethod)
document(self) QTextDocument

Returns a reference to the QTextDocument shown in the widget.

Return type

QTextDocument

dragEnterEvent(self, QDragEnterEvent)
dragLeaveEvent(self, QDragLeaveEvent)
dragMoveEvent(self, QDragMoveEvent)
dropEvent(self, QDropEvent)
enterEvent(self, QEvent)
event(self, QEvent) bool
focusInEvent(self, event: QFocusEvent)
Parameters

event (QFocusEvent) –

focusNextChild(self) bool
focusNextPrevChild(self, bool) bool
focusOutEvent(self, QFocusEvent)
focusPreviousChild(self) bool
hideEvent(self, QHideEvent)
initPainter(self, QPainter)
inputMethodEvent(self, QInputMethodEvent)
isSignalConnected(self, QMetaMethod) bool
keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
leaveEvent(self, QEvent)
metric(self, QPaintDevice.PaintDeviceMetric) int
mouseDoubleClickEvent(self, QMouseEvent)
mouseMoveEvent(self, QMouseEvent)
mousePressEvent(self, QMouseEvent)
mouseReleaseEvent(self, QMouseEvent)
moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], PyQt5.sip.voidptr) Tuple[bool, int]
paintEvent(self, QPaintEvent)
receivers(self, PYQT_SIGNAL) int
resizeEvent(self, QResizeEvent)
sender(self) QObject
senderSignalIndex(self) int
setText(self, text: str)

Sets the text to show in the widget.

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

Parameters

text (str) –

setTextCursor(self, cursor: QTextCursor)

Sets the current text cursor.

See also

textCursor()

Parameters

cursor (QTextCursor) –

sharedPainter(self) QPainter
showEvent(self, QShowEvent)
tabletEvent(self, QTabletEvent)
textChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type

PYQT_SIGNAL

textCursor(self) QTextCursor

Returns a reference to the text cursor.

See also

setTextCursor()

Return type

QTextCursor

timerEvent(self, QTimerEvent)
toHtml(self) str

Returns the widget’s content as a HTML string.

See also

toPlainText()

Return type

str

toPlainText(self) str

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

See also

toHtml()

Return type

str

updateMicroFocus(self)
wheelEvent(self, QWheelEvent)