From 605634a88a05f175de77e1c7af59fd2a2e0cbc41 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 25 Mar 2019 14:44:14 +0100 Subject: Doc: Note Q[Plain]TextEdit keeping formatting in some cases Fixes: QTBUG-72427 Change-Id: Ifddabb175c480b64282bd8c8fdb9edab4c7ecf44 Reviewed-by: Venugopal Shivashankar --- src/widgets/widgets/qtextedit.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src/widgets/widgets/qtextedit.cpp') diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp index e3a45680ef..ab636660d7 100644 --- a/src/widgets/widgets/qtextedit.cpp +++ b/src/widgets/widgets/qtextedit.cpp @@ -548,7 +548,8 @@ void QTextEditPrivate::_q_ensureVisible(const QRectF &_rect) This property gets and sets the text editor's contents as plain text. Previous contents are removed and undo/redo history is reset - when the property is set. + when the property is set. currentCharFormat() is also reset, unless + textCursor() is already at the beginning of the document. If the text edit has another content type, it will not be replaced by plain text if you call toPlainText(). The only exception to this @@ -1026,7 +1027,12 @@ void QTextEdit::paste() /*! Deletes all the text in the text edit. - Note that the undo/redo history is cleared by this function. + Notes: + \list + \li The undo/redo history is also cleared. + \li currentCharFormat() is reset, unless textCursor() + is already at the beginning of the document. + \endlist \sa cut(), setPlainText(), setHtml() */ @@ -1131,9 +1137,13 @@ void QTextEdit::timerEvent(QTimerEvent *e) Changes the text of the text edit to the string \a text. Any previous text is removed. - \a text is interpreted as plain text. - - Note that the undo/redo history is cleared by this function. + Notes: + \list + \li \a text is interpreted as plain text. + \li The undo/redo history is also cleared. + \li currentCharFormat() is reset, unless textCursor() + is already at the beginning of the document. + \endlist \sa toPlainText() */ @@ -1167,7 +1177,8 @@ QString QTextEdit::toPlainText() const setHtml() changes the text of the text edit. Any previous text is removed and the undo/redo history is cleared. The input text is - interpreted as rich text in html format. + interpreted as rich text in html format. currentCharFormat() is also + reset, unless textCursor() is already at the beginning of the document. \note It is the responsibility of the caller to make sure that the text is correctly decoded when a QString containing HTML is created -- cgit v1.2.3