Fix QWidget::isActiveWindow for window containers.

Change-Id: If0e8b83d7dc84b66f4ce5a5cd98affa4bd9b7424
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
This commit is contained in:
Gunnar Sletta 2013-06-24 16:09:49 +02:00 committed by The Qt Project
parent 63601509f8
commit 6811920dea

View File

@ -104,6 +104,8 @@
#include "qtabwidget.h" // Needed in inTabWidget()
#endif // QT_KEYPAD_NAVIGATION
#include "qwindowcontainer_p.h"
// widget/widget data creation count
//#define QWIDGET_EXTRA_DEBUG
@ -6249,6 +6251,17 @@ bool QWidget::isActiveWindow() const
}
}
// Check for an active window container
if (QWindow *ww = QGuiApplication::focusWindow()) {
while (ww) {
QWidgetWindow *qww = qobject_cast<QWidgetWindow *>(ww);
QWindowContainer *qwc = qww ? qobject_cast<QWindowContainer *>(qww->widget()) : 0;
if (qwc && qwc->topLevelWidget() == tlw)
return true;
ww = ww->parent();
}
}
// Check if platform adaptation thinks the window is active. This is necessary for
// example in case of ActiveQt servers that are embedded into another application.
// Those are separate processes that are not part of the parent application Qt window/widget