Ignore the fullscreen state of a QMdiSubWindow
On some platforms all windows are by default forced into fullscreen mode when show() is executed. In QMdiSubWindow we cannot handle the fullscreen state and should ignore it. Otherwise the window will be forced in "normal" state and ignore any previously executed geometry changes. Change-Id: I09ce6507a1eac6a0adb3405ca3f423642d30f801 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Bernd Weimer <bweimer@blackberry.com>
This commit is contained in:
parent
2567b35a5e
commit
637b6e1097
@ -1676,15 +1676,18 @@ void QMdiSubWindowPrivate::ensureWindowState(Qt::WindowState state)
|
||||
switch (state) {
|
||||
case Qt::WindowMinimized:
|
||||
windowStates &= ~Qt::WindowMaximized;
|
||||
windowStates &= ~Qt::WindowFullScreen;
|
||||
windowStates &= ~Qt::WindowNoState;
|
||||
break;
|
||||
case Qt::WindowMaximized:
|
||||
windowStates &= ~Qt::WindowMinimized;
|
||||
windowStates &= ~Qt::WindowFullScreen;
|
||||
windowStates &= ~Qt::WindowNoState;
|
||||
break;
|
||||
case Qt::WindowNoState:
|
||||
windowStates &= ~Qt::WindowMinimized;
|
||||
windowStates &= ~Qt::WindowMaximized;
|
||||
windowStates &= ~Qt::WindowFullScreen;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -2732,7 +2735,7 @@ bool QMdiSubWindow::eventFilter(QObject *object, QEvent *event)
|
||||
showMinimized();
|
||||
else if (!(oldState & Qt::WindowMaximized) && (newState & Qt::WindowMaximized))
|
||||
showMaximized();
|
||||
else if (!(newState & (Qt::WindowMaximized | Qt::WindowMinimized)))
|
||||
else if (!(newState & (Qt::WindowMaximized | Qt::WindowMinimized | Qt::WindowFullScreen)))
|
||||
showNormal();
|
||||
break;
|
||||
}
|
||||
@ -3005,7 +3008,7 @@ void QMdiSubWindow::changeEvent(QEvent *changeEvent)
|
||||
d->setMinimizeMode();
|
||||
else if (!(oldState & Qt::WindowMaximized) && (newState & Qt::WindowMaximized))
|
||||
d->setMaximizeMode();
|
||||
else if (!(newState & (Qt::WindowMaximized | Qt::WindowMinimized)))
|
||||
else if (!(newState & (Qt::WindowMaximized | Qt::WindowMinimized | Qt::WindowFullScreen)))
|
||||
d->setNormalMode();
|
||||
|
||||
if (d->isActive)
|
||||
|
@ -206,6 +206,7 @@ private slots:
|
||||
void task_233197();
|
||||
void task_226929();
|
||||
void styleChange();
|
||||
void testFullScreenState();
|
||||
};
|
||||
|
||||
void tst_QMdiSubWindow::initTestCase()
|
||||
@ -2007,6 +2008,19 @@ void tst_QMdiSubWindow::styleChange()
|
||||
QCOMPARE(spy.count(), 0);
|
||||
}
|
||||
|
||||
void tst_QMdiSubWindow::testFullScreenState()
|
||||
{
|
||||
QMdiArea mdiArea;
|
||||
mdiArea.showMaximized();
|
||||
|
||||
QMdiSubWindow *subWindow = mdiArea.addSubWindow(new QWidget);
|
||||
subWindow->setGeometry(0, 0, 300, 300);
|
||||
subWindow->showFullScreen(); // QMdiSubWindow does not support the fullscreen state. This call
|
||||
// should be equivalent to setVisible(true) (and not showNormal())
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&mdiArea));
|
||||
QCOMPARE(subWindow->size(), QSize(300, 300));
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QMdiSubWindow)
|
||||
#include "tst_qmdisubwindow.moc"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user