From 402d37b3b6cc9cd4a03bc4290d204b4977dbc1d4 Mon Sep 17 00:00:00 2001 From: Tobias Markmann <tm@ayena.de> Date: Fri, 27 May 2016 08:20:10 +0200 Subject: Fix QtSuggestingJIDInput popup behavior on OS X MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QtSuggestingJIDInput is used by the 'Start Chat…' dialog and other dialogs. Keyboard usage of the widget works fine. Clicking on a suggested item via touchpad/mouse will correctly select the item. However, when the popup is hidden, the dialog containing the QtSuggestingJIDInput is not the top window but will be in the background instead. With the workaround, the dialog will be on top of the window hierarchy if a suggested item is selected by click. Test-Information: Tested that this workaround is not required on Windows 8 and Ubuntu 16.04. Tested this workaround works on OS X 10.11.5 with Qt 5.4.2. Change-Id: I77f0aa5f92268da1867f61d9f6e1fbc66a724c17 diff --git a/Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp b/Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp index d20c285..8c46e38 100644 --- a/Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp +++ b/Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp @@ -19,6 +19,7 @@ #include <QApplication> #include <QDesktopWidget> #include <QKeyEvent> +#include <QtGlobal> #include <Swift/Controllers/Settings/SettingsProvider.h> @@ -204,6 +205,11 @@ void QtSuggestingJIDInput::hidePopup() { // Give focus back to input widget because the hide() call passes the focus to the wrong widget. setFocus(); +#if defined(Q_WS_MAC) + // This workaround is needed on OS X, to bring the dialog containing this widget back to the front after + // the popup is hidden. Ubuntu 16.04 and Windows 8 do not have this issue. + window()->raise(); +#endif } } -- cgit v0.10.2-6-g49f6