summaryrefslogtreecommitdiffstats
path: root/tests/manual/windowflags/controllerwindow.cpp
diff options
context:
space:
mode:
authorMorten Johan Sorvig <morten.sorvig@nokia.com>2012-03-21 11:07:35 +0100
committerQt by Nokia <qt-info@nokia.com>2012-04-20 10:29:14 +0200
commit128b7c56b732cabdbd600445aac5162c775e58d4 (patch)
treec6699b97cdd9522bb24cf8588810c12d03dd60bc /tests/manual/windowflags/controllerwindow.cpp
parent872f567d530daad7d897767fd56e061d8f4e5f36 (diff)
Implement QCocoaWindow::setWindowState.
Add window state change notification logic. Send and expose event in addition to window state change on window restore since the QWidget logic expects this. Modify QCocoaWindow::setVisible to sync up window state that may have been set on the hidden window. Refactor NSWindow event observing to use one observer function for all notifications. Add window state testing to tests/manual/windowflags Add delay after showFullScreen in tst_qstatusbar to wait for the Lion fullscreen transition. Change-Id: I57c523cedd0644d4181b40d72046fad4fdb09a9c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'tests/manual/windowflags/controllerwindow.cpp')
-rw-r--r--tests/manual/windowflags/controllerwindow.cpp35
1 files changed, 34 insertions, 1 deletions
diff --git a/tests/manual/windowflags/controllerwindow.cpp b/tests/manual/windowflags/controllerwindow.cpp
index 586691a37d..cee8976cfe 100644
--- a/tests/manual/windowflags/controllerwindow.cpp
+++ b/tests/manual/windowflags/controllerwindow.cpp
@@ -62,6 +62,7 @@ ControllerWindow::ControllerWindow()
previewDialog = new PreviewDialog;
createTypeGroupBox();
+ createStateGroupBox();
createHintsGroupBox();
quitButton = new QPushButton(tr("&Quit"));
@@ -73,6 +74,7 @@ ControllerWindow::ControllerWindow()
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(widgetTypeGroupBox);
+ mainLayout->addWidget(windowStateGroupBox);
mainLayout->addWidget(additionalOptionsGroupBox);
mainLayout->addWidget(typeGroupBox);
mainLayout->addWidget(hintsGroupBox);
@@ -165,7 +167,17 @@ void ControllerWindow::updatePreview()
if (pos.y() < 0)
pos.setY(0);
widget->move(pos);
- widget->show();
+
+ Qt::WindowState windowState = Qt::WindowNoState;
+ if (minimizeButton->isChecked())
+ windowState = Qt::WindowMinimized;
+ else if (maximizeButton->isChecked())
+ windowState = Qt::WindowMaximized;
+ else if (fullscreenButton->isChecked())
+ windowState = Qt::WindowFullScreen;
+
+ widget->setWindowState(windowState);
+ widget->setVisible(visibleCheckBox->isChecked());
}
void ControllerWindow::createTypeGroupBox()
@@ -212,6 +224,27 @@ void ControllerWindow::createTypeGroupBox()
}
//! [5]
+void ControllerWindow::createStateGroupBox()
+{
+ windowStateGroupBox = new QGroupBox(tr("Window State"));
+ visibleCheckBox = createCheckBox(tr("Visible"));
+ visibleCheckBox->setChecked(true);
+
+ restoreButton = createRadioButton(tr("Normal"));
+ restoreButton->setChecked(true);
+ minimizeButton = createRadioButton(tr("Minimized"));
+ maximizeButton = createRadioButton(tr("Maximized"));
+ fullscreenButton = createRadioButton(tr("Fullscreen"));;
+
+ QHBoxLayout *l = new QHBoxLayout;
+ l->addWidget(visibleCheckBox);
+ l->addWidget(restoreButton);
+ l->addWidget(minimizeButton);
+ l->addWidget(maximizeButton);
+ l->addWidget(fullscreenButton);
+ windowStateGroupBox->setLayout(l);
+}
+
//! [6]
void ControllerWindow::createHintsGroupBox()
{