Do not call requestActivateWindow() on popups.

Showing a compo dropdown would cause the parent to
become deactivated (Windows). Introduced by:

8368557b9c for
QTBUG-25852 , QTBUG-23699 .

Task-number: QTBUG-27145
Change-Id: I7b89697a2c55d58cc0ab184b61a0cff8bf2275ec
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Reviewed-by: Jonathan Liu <net147@gmail.com>
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
This commit is contained in:
Friedemann Kleint 2012-09-07 09:36:49 +02:00 committed by Qt by Nokia
parent b41bd2b08d
commit a02d1ac962

View File

@ -684,10 +684,13 @@ void QWidgetPrivate::setFocus_sys()
{
Q_Q(QWidget);
// Embedded native widget may have taken the focus; get it back to toplevel if that is the case
if (QWindow *nativeWindow = q->window()->windowHandle()) {
if (nativeWindow != QGuiApplication::focusWindow()
&& q->testAttribute(Qt::WA_WState_Created)) {
nativeWindow->requestActivateWindow();
const QWidget *topLevel = q->window();
if (topLevel->windowType() != Qt::Popup) {
if (QWindow *nativeWindow = q->window()->windowHandle()) {
if (nativeWindow != QGuiApplication::focusWindow()
&& q->testAttribute(Qt::WA_WState_Created)) {
nativeWindow->requestActivateWindow();
}
}
}
}