diff options
author | Tobias Markmann <tm@ayena.de> | 2014-12-02 23:54:24 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2014-12-10 16:07:10 (GMT) |
commit | 92672e17a52d0c86e693183627c8c6b8fa44fb86 (patch) | |
tree | 5064a73aa3e7e84dc1b9d92f3acbe277a41bbaeb /Swift/QtUI/QtSpellCheckHighlighter.h | |
parent | 85b66ce2be8fadc671eb35e45d6caeb8930b39c8 (diff) | |
download | swift-92672e17a52d0c86e693183627c8c6b8fa44fb86.zip swift-92672e17a52d0c86e693183627c8c6b8fa44fb86.tar.bz2 |
Fix spell checking by using QSyntaxHighlighter.
This fixes spell checking not interfering with Qt's undo stack management anymore.
Test-Information:
Tested on OS X 10.9.5 with Qt 5.3.2.
Change-Id: Icc3aa9f7213856388e4da317525c75ac97da72e3
Diffstat (limited to 'Swift/QtUI/QtSpellCheckHighlighter.h')
-rw-r--r-- | Swift/QtUI/QtSpellCheckHighlighter.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Swift/QtUI/QtSpellCheckHighlighter.h b/Swift/QtUI/QtSpellCheckHighlighter.h new file mode 100644 index 0000000..c1cfc70 --- /dev/null +++ b/Swift/QtUI/QtSpellCheckHighlighter.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2014 Kevin Smith and Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <SwifTools/SpellParser.h> + +#include <QSyntaxHighlighter> + +class QString; +class QTextDocument; + +namespace Swift { + +class SpellChecker; + +class QtSpellCheckHighlighter : public QSyntaxHighlighter { + Q_OBJECT + +public: + QtSpellCheckHighlighter(QTextDocument* parent, SpellChecker* spellChecker); + virtual ~QtSpellCheckHighlighter(); + + PositionPairList getMisspelledPositions() const; + +protected: + virtual void highlightBlock(const QString& text); + +private: + SpellChecker* checker_; + PositionPairList misspelledPositions_; +}; + + +} |