diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-10-08 22:37:46 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-10-08 22:38:24 +0200 |
commit | 9f2626385bf9c12a240f5fd17b90304c231fba5e (patch) | |
tree | 24ed7d30ac7e54f54f78cab0a2e1163e6298b014 /framework/src/domain/textdocumenthandler.cpp | |
parent | f1e9fd9c4b5a166f8d0cbcec099470cbcea0f058 (diff) | |
download | kube-9f2626385bf9c12a240f5fd17b90304c231fba5e.tar.gz kube-9f2626385bf9c12a240f5fd17b90304c231fba5e.zip |
Clear all formatting when converting to plain text.
We used to end up with whatever formatting the current cursor had.
Task: https://phabricator.kde.org/T7160
Diffstat (limited to 'framework/src/domain/textdocumenthandler.cpp')
-rw-r--r-- | framework/src/domain/textdocumenthandler.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/framework/src/domain/textdocumenthandler.cpp b/framework/src/domain/textdocumenthandler.cpp index 729d39e8..6c2bc323 100644 --- a/framework/src/domain/textdocumenthandler.cpp +++ b/framework/src/domain/textdocumenthandler.cpp | |||
@@ -32,6 +32,17 @@ TextDocumentHandler::TextDocumentHandler(QObject *parent) | |||
32 | { | 32 | { |
33 | } | 33 | } |
34 | 34 | ||
35 | void TextDocumentHandler::resetFormat() | ||
36 | { | ||
37 | //Clear all formatting from the document. | ||
38 | auto cursor = textCursor(); | ||
39 | cursor.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor); | ||
40 | cursor.movePosition(QTextCursor::End, QTextCursor::KeepAnchor); | ||
41 | cursor.setCharFormat({}); | ||
42 | mCachedTextFormat = {}; | ||
43 | reset(); | ||
44 | } | ||
45 | |||
35 | QQuickTextDocument *TextDocumentHandler::document() const | 46 | QQuickTextDocument *TextDocumentHandler::document() const |
36 | { | 47 | { |
37 | return mDocument; | 48 | return mDocument; |