Partially revert "Move notification of layout change up from QApplication to QGuiApplication."
We can't rely on QGuiApplication::topLevelWindows containing top level QWidgets, because they only exist as actual windows once QWidgetPrivate::create_sys is called. Thus, make sure to send notifications to all top level widgets, if a QApplication is being used. This reverts commit f82ed5b3e30282bb8dc1da321a0d04ad4d463e59. Task-number: QTBUG-35589 Change-Id: Iac517089af1c22f20094ba6e185d5ed44ebe3d6f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>bb10
parent
b7cb0613f0
commit
9b621f3861
|
|
@ -1888,6 +1888,31 @@ bool QApplication::event(QEvent *e)
|
|||
\obsolete
|
||||
*/
|
||||
|
||||
// ### FIXME: topLevelWindows does not contain QWidgets without a parent
|
||||
// until create_sys is called. So we have to override the
|
||||
// QGuiApplication::notifyLayoutDirectionChange
|
||||
// to do the right thing.
|
||||
void QApplicationPrivate::notifyLayoutDirectionChange()
|
||||
{
|
||||
const QWidgetList list = QApplication::topLevelWidgets();
|
||||
QWindowList windowList = QGuiApplication::topLevelWindows();
|
||||
|
||||
// send to all top-level QWidgets
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
QWidget *w = list.at(i);
|
||||
windowList.removeAll(w->windowHandle());
|
||||
QEvent ev(QEvent::ApplicationLayoutDirectionChange);
|
||||
QCoreApplication::sendEvent(w, &ev);
|
||||
}
|
||||
|
||||
// in case there are any plain QWindows in this QApplication-using
|
||||
// application, also send the notification to them
|
||||
for (int i = 0; i < windowList.size(); ++i) {
|
||||
QEvent ev(QEvent::ApplicationLayoutDirectionChange);
|
||||
QCoreApplication::sendEvent(windowList.at(i), &ev);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void QApplication::setActiveWindow(QWidget* active)
|
||||
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ public:
|
|||
QApplicationPrivate(int &argc, char **argv, int flags);
|
||||
~QApplicationPrivate();
|
||||
|
||||
virtual void notifyLayoutDirectionChange();
|
||||
virtual void notifyActiveWindowChange(QWindow *);
|
||||
|
||||
virtual bool shouldQuit();
|
||||
|
|
|
|||
Loading…
Reference in New Issue