summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2015-05-18 20:10:57 (GMT)
committerKevin Smith <kevin.smith@isode.com>2015-05-26 16:07:14 (GMT)
commit0c5d33fdc77226ea1a447211ea4b2198197ec715 (patch)
treef626def04c6abcb7d688c64f48fb6e6d4fd8be27 /Swift/QtUI/QtTextEdit.cpp
parente544a3ad5a8d3cdf67554384f53895fad34ff9bc (diff)
downloadswift-0c5d33fdc77226ea1a447211ea4b2198197ec715.zip
swift-0c5d33fdc77226ea1a447211ea4b2198197ec715.tar.bz2
Fix trellis related bugs
Bugs like: * Tab title not matching shown chat window * Duplicated tab titles after tab movement Swift is also subject to QTBUG-36455, which is fixed for Qt >= 5.3.0. This commit removes the use of application wide focus handlers in QtChatWindow class, the QtChatWindow::qAppFocusChanged method. The reason for this is due to the way QTabBar::moveTab is implemented in Qt which we use for the Trellis feature. Internally QTabBar::moveTab first adjusts its tab bar labels, then removes the tab from its old location in the internal QStackedLayout and then inserts it in the new location. After the remove Qt gives focus to another widget via a focus change that does not go through the event loop of the application and is not interceptable with eventFilters. Previously we would set the focus and call other signals in the application wide focus change handler which then used the currently inconsistent QTabBar/QTabWidget. Test-Information: Tested tab switching and movement on Windows 8 (Qt 5.3.2), OS X 10.9.5 (Qt 5.4.3) and Ubuntu 14.04.2 LTS (Qt 5.4.3). Change-Id: Ief423c4add58a90279109f72fac95fc58cb71111
Diffstat (limited to 'Swift/QtUI/QtTextEdit.cpp')
-rw-r--r--Swift/QtUI/QtTextEdit.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/Swift/QtUI/QtTextEdit.cpp b/Swift/QtUI/QtTextEdit.cpp
index a381cbe..fed8819 100644
--- a/Swift/QtUI/QtTextEdit.cpp
+++ b/Swift/QtUI/QtTextEdit.cpp
@@ -1,28 +1,28 @@
/*
- * Copyright (c) 2010-2014 Isode Limited.
+ * Copyright (c) 2010-2015 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <Swift/QtUI/QtTextEdit.h>
-#include <boost/tuple/tuple.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/bind.hpp>
+#include <boost/tuple/tuple.hpp>
#include <QApplication>
#include <QFontMetrics>
#include <QKeyEvent>
-#include <QDebug>
#include <QMenu>
+#include <QTime>
#include <Swiften/Base/foreach.h>
-#include <SwifTools/SpellCheckerFactory.h>
-#include <SwifTools/SpellChecker.h>
-
#include <Swift/Controllers/SettingConstants.h>
+#include <SwifTools/SpellChecker.h>
+#include <SwifTools/SpellCheckerFactory.h>
+
#include <Swift/QtUI/QtSpellCheckerWindow.h>
#include <Swift/QtUI/QtSwiftUtil.h>
#include <Swift/QtUI/QtUtilities.h>
@@ -75,6 +75,16 @@ void QtTextEdit::keyPressEvent(QKeyEvent* event) {
}
}
+void QtTextEdit::focusInEvent(QFocusEvent* event) {
+ receivedFocus();
+ QTextEdit::focusInEvent(event);
+}
+
+void QtTextEdit::focusOutEvent(QFocusEvent* event) {
+ lostFocus();
+ QTextEdit::focusOutEvent(event);
+}
+
void QtTextEdit::handleTextChanged() {
QSize previous(maximumSize());
setMaximumSize(QSize(maximumWidth(), sizeHint().height()));