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

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)
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)