summaryrefslogtreecommitdiffstats
path: root/framework/src
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src')
-rw-r--r--framework/src/domain/textdocumenthandler.cpp11
-rw-r--r--framework/src/domain/textdocumenthandler.h2
2 files changed, 13 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
35void 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
35QQuickTextDocument *TextDocumentHandler::document() const 46QQuickTextDocument *TextDocumentHandler::document() const
36{ 47{
37 return mDocument; 48 return mDocument;
diff --git a/framework/src/domain/textdocumenthandler.h b/framework/src/domain/textdocumenthandler.h
index b8ae5bdb..43781940 100644
--- a/framework/src/domain/textdocumenthandler.h
+++ b/framework/src/domain/textdocumenthandler.h
@@ -86,6 +86,8 @@ public:
86 int fontSize() const; 86 int fontSize() const;
87 void setFontSize(int size); 87 void setFontSize(int size);
88 88
89 Q_INVOKABLE void resetFormat();
90
89Q_SIGNALS: 91Q_SIGNALS:
90 void documentChanged(); 92 void documentChanged();
91 void cursorPositionChanged(); 93 void cursorPositionChanged();