diff options
author | Tobias Markmann <tm@ayena.de> | 2016-09-12 11:05:38 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-10-20 09:54:07 (GMT) |
commit | 7f6e2a0fa9338da89339111aad93d205b5e15ec6 (patch) | |
tree | 61d95807afe1880d6a16e01488b60185610bf618 /Swift/QtUI/QtTextEdit.h | |
parent | a0199d151c8c0286caa5185988b5604d7e1e2d52 (diff) | |
download | swift-7f6e2a0fa9338da89339111aad93d205b5e15ec6.zip swift-7f6e2a0fa9338da89339111aad93d205b5e15ec6.tar.bz2 |
Fix focus rect vanishing in trellis mode after sending a message
QtChatWindow was setting and resetting the Qt stylesheet for
the chat input for message correction UI. This conflicted
with the focus rectangle styling.
Moved correction styling inside QtTextEdit which can handle
focus rectangle and correction background styling together
without overriding each other.
On OS X, the native focus rectangle drawing, i.e. setting
the Qt::WA_MacShowFocusRect widget attribute on the input,
can not be used anymore, as it conflicts with setting the
stylesheet for the correction background color.
Test-Information:
Tested message correction, trellis and security label UI on
OS X 10.11.6 and Windows 8 with Qt 5.5.1.
Change-Id: I0b771a2d47d5437512e870a9887b0b6e7262b359
Diffstat (limited to 'Swift/QtUI/QtTextEdit.h')
-rw-r--r-- | Swift/QtUI/QtTextEdit.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Swift/QtUI/QtTextEdit.h b/Swift/QtUI/QtTextEdit.h index 921c4b9..228aa9e 100644 --- a/Swift/QtUI/QtTextEdit.h +++ b/Swift/QtUI/QtTextEdit.h @@ -1,66 +1,68 @@ /* * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <QPointer> #include <QTextEdit> -#include <Swift/Controllers/SettingConstants.h> #include <Swift/Controllers/Settings/SettingsProvider.h> #include <SwifTools/SpellParser.h> #include <Swift/QtUI/QtSpellCheckHighlighter.h> namespace Swift { class SpellChecker; class QtSpellCheckerWindow; class QtTextEdit : public QTextEdit { Q_OBJECT public: QtTextEdit(SettingsProvider* settings, QWidget* parent = nullptr); virtual ~QtTextEdit(); virtual QSize sizeHint() const; + void setEmphasiseFocus(bool emphasise); + void setCorrectionHighlight(bool coorectionHighlight); signals: void wordCorrected(QString& word); void returnPressed(); void unhandledKeyPressEvent(QKeyEvent* event); void receivedFocus(); void lostFocus(); public slots: void handleSettingChanged(const std::string& settings); protected: virtual void keyPressEvent(QKeyEvent* event); virtual void focusInEvent(QFocusEvent* event); virtual void focusOutEvent(QFocusEvent* event); virtual void contextMenuEvent(QContextMenuEvent* event); private slots: void handleTextChanged(); private: void addSuggestions(QMenu* menu, QContextMenuEvent* event); void replaceMisspelledWord(const QString& word, int cursorPosition); void setUpSpellChecker(); void spellCheckerSettingsWindow(); PositionPair getWordFromCursor(int cursorPosition); - void updateEmphasisedFocus(); + void updateStyleSheet(); private: SpellChecker* checker_; QtSpellCheckHighlighter* highlighter_; std::vector<QAction*> replaceWordActions_; SettingsProvider* settings_; QPointer<QtSpellCheckerWindow> spellCheckerWindow_; bool emphasiseFocus_ = false; + bool correctionHighlight_ = false; }; } |