diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-09-13 11:56:52 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-09-13 11:58:09 +0200 |
commit | c1edda931d81f159e5c4be9f753153b621bdbad2 (patch) | |
tree | 813f713d8ab7d73f910dff8e2e8781506a01469c /framework/src/domain/documenthandler.h | |
parent | 152aff4c7e26c4eccf0168ae401dbcd13b54c796 (diff) | |
download | kube-c1edda931d81f159e5c4be9f753153b621bdbad2.tar.gz kube-c1edda931d81f159e5c4be9f753153b621bdbad2.zip |
Replaced the invisible char hack with a better solution
We now cache the format until the next char is inserted,
which seems to work fine, doesn't break selection and is overall much
cleaner.
Diffstat (limited to 'framework/src/domain/documenthandler.h')
-rw-r--r-- | framework/src/domain/documenthandler.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/framework/src/domain/documenthandler.h b/framework/src/domain/documenthandler.h index 0c1bf971..8be3ba16 100644 --- a/framework/src/domain/documenthandler.h +++ b/framework/src/domain/documenthandler.h | |||
@@ -140,8 +140,12 @@ Q_SIGNALS: | |||
140 | 140 | ||
141 | void textChanged(); | 141 | void textChanged(); |
142 | 142 | ||
143 | private Q_SLOTS: | ||
144 | void contentsChange(int position, int charsRemoved, int charsAdded); | ||
145 | |||
143 | private: | 146 | private: |
144 | void reset(); | 147 | void reset(); |
148 | QTextCharFormat charFormat() const; | ||
145 | QTextCursor textCursor() const; | 149 | QTextCursor textCursor() const; |
146 | QTextDocument *textDocument() const; | 150 | QTextDocument *textDocument() const; |
147 | void mergeFormatOnWordOrSelection(const QTextCharFormat &format); | 151 | void mergeFormatOnWordOrSelection(const QTextCharFormat &format); |
@@ -151,6 +155,7 @@ private: | |||
151 | int m_cursorPosition; | 155 | int m_cursorPosition; |
152 | int m_selectionStart; | 156 | int m_selectionStart; |
153 | int m_selectionEnd; | 157 | int m_selectionEnd; |
158 | QSharedPointer<QTextCharFormat> m_cachedTextFormat; | ||
154 | }; | 159 | }; |
155 | 160 | ||
156 | #endif // DOCUMENTHANDLER_H | 161 | #endif // DOCUMENTHANDLER_H |