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/QtTextEdit.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/QtTextEdit.h')
| -rw-r--r-- | Swift/QtUI/QtTextEdit.h | 23 | 
1 files changed, 16 insertions, 7 deletions
diff --git a/Swift/QtUI/QtTextEdit.h b/Swift/QtUI/QtTextEdit.h index a8df4d3..5f16453 100644 --- a/Swift/QtUI/QtTextEdit.h +++ b/Swift/QtUI/QtTextEdit.h @@ -1,5 +1,5 @@  /* - * Copyright (c) 2010 Kevin Smith + * Copyright (c) 2010-2014 Kevin Smith   * Licensed under the GNU General Public License v3.   * See Documentation/Licenses/GPLv3.txt for more information.   */ @@ -11,40 +11,49 @@  #include <Swift/Controllers/Settings/SettingsProvider.h>  #include <Swift/Controllers/SettingConstants.h> +#include <Swift/QtUI/QtSpellCheckHighlighter.h> +  #include <QTextEdit>  #include <QPointer>  namespace Swift {  	class SpellChecker;  	class QtSpellCheckerWindow; +  	class QtTextEdit : public QTextEdit {  		Q_OBJECT  	public:  		QtTextEdit(SettingsProvider* settings, QWidget* parent = 0);  		virtual ~QtTextEdit();  		virtual QSize sizeHint() const; +  	signals:  		void wordCorrected(QString& word);  		void returnPressed();  		void unhandledKeyPressEvent(QKeyEvent* event); +  	public slots:  		void handleSettingChanged(const std::string& settings); +  	protected:  		virtual void keyPressEvent(QKeyEvent* event);  		virtual void contextMenuEvent(QContextMenuEvent* event); +  	private slots:  		void handleTextChanged(); +  	private: -		SpellChecker *checker_; -		std::vector<QAction*> replaceWordActions_; -		PositionPairList misspelledPositions_; -		SettingsProvider *settings_; -		QPointer<QtSpellCheckerWindow> spellCheckerWindow_;  		void addSuggestions(QMenu* menu, QContextMenuEvent* event);  		void replaceMisspelledWord(const QString& word, int cursorPosition);  		void setUpSpellChecker(); -		void underlineMisspells();  		void spellCheckerSettingsWindow();  		PositionPair getWordFromCursor(int cursorPosition); + +	private: +		SpellChecker* checker_; +		QtSpellCheckHighlighter* highlighter_; +		std::vector<QAction*> replaceWordActions_; +		SettingsProvider* settings_; +		QPointer<QtSpellCheckerWindow> spellCheckerWindow_;  	};  }  | 
 Swift