summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJanne Anttila <janne.anttila@digia.com>2009-09-11 08:13:28 (GMT)
committerJanne Anttila <janne.anttila@digia.com>2009-09-11 08:13:28 (GMT)
commitdacb14e457b40b6839e9f17ec968e95e29113d20 (patch)
tree380423d4f3d3cae9c8e2e628b2931404c6499b78
parentf9243aac1e26ccf9f46cc1d7de5f57063a053211 (diff)
downloadQt-dacb14e457b40b6839e9f17ec968e95e29113d20.zip
Qt-dacb14e457b40b6839e9f17ec968e95e29113d20.tar.gz
Qt-dacb14e457b40b6839e9f17ec968e95e29113d20.tar.bz2
Fixed QWidget::setWindowState for Symbian.
Before this commit calling setWindowState(Qt::WindowFullScreen) on a widget instance affected all new widget instances created after this method. This bug happened due to fact that window decorations i.e. statuspane and softkeys visibility was only changed when switching to or from fullscreen state. In the reported bug it happened that second widget was initially in Qt::WindowNoState and it was changed to Maximized. Since window decorations are global not window specific at the moment, the default decoration visibility for second window is the one to which previous window has set them. In this case previous window was in fullscreen and that's why the decorations were visible also for second maximized window. Probably the right fix would be to change the decoration to window specific but that is quite a big change and for now the bug is fixed with this commit. Autotest: Excluding new test case, same results before and after. Task-number: 261048 Reviewed-by: Jason Barron
-rw-r--r--src/gui/kernel/qwidget_s60.cpp43
-rw-r--r--tests/auto/qwidget/qwidget.pro1
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp43
3 files changed, 71 insertions, 16 deletions
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 94f3532..7509fa5 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -989,6 +989,32 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
return;
if (isWindow()) {
+#ifdef Q_WS_S60
+ // Change window decoration visibility if switching to or from fullsccreen
+ // In addition decoration visibility is changed when the initial has been
+ // WindowNoState.
+ // The window decoration visibility has to be changed before doing actual
+ // window state change since in that order the availableGeometry will return
+ // directly the right size and we will avoid unnecessarty redraws
+ if((oldstate & Qt::WindowFullScreen) != (newstate & Qt::WindowFullScreen) ||
+ oldstate == Qt::WindowNoState) {
+ CEikStatusPane* statusPane = S60->statusPane();
+ CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer();
+ if (newstate & Qt::WindowFullScreen) {
+ if (statusPane)
+ statusPane->MakeVisible(false);
+ if (buttonGroup)
+ buttonGroup->MakeVisible(false);
+ } else {
+ if (statusPane)
+ statusPane->MakeVisible(true);
+ if (buttonGroup)
+ buttonGroup->MakeVisible(true);
+ }
+
+ }
+#endif // Q_WS_S60
+
createWinId();
Q_ASSERT(testAttribute(Qt::WA_WState_Created));
QTLWExtra *top = d->topData();
@@ -1013,30 +1039,15 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
}
}
if ((oldstate & Qt::WindowFullScreen) != (newstate & Qt::WindowFullScreen)) {
-#ifdef Q_WS_S60
- CEikStatusPane* statusPane = S60->statusPane();
- CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer();
-#endif
if (newstate & Qt::WindowFullScreen) {
const QRect normalGeometry = geometry();
const QRect r = top->normalGeometry;
setGeometry(qApp->desktop()->screenGeometry(this));
-#ifdef Q_WS_S60
- if (statusPane)
- statusPane->MakeVisible(false);
- if (buttonGroup)
- buttonGroup->MakeVisible(false);
-#endif
+
top->normalGeometry = r;
if (top->normalGeometry.width() < 0)
top->normalGeometry = normalGeometry;
} else {
-#ifdef Q_WS_S60
- if (statusPane)
- statusPane->MakeVisible(true);
- if (buttonGroup)
- buttonGroup->MakeVisible(true);
-#endif
if (newstate & Qt::WindowMaximized) {
const QRect r = top->normalGeometry;
setGeometry(qApp->desktop()->availableGeometry(this));
diff --git a/tests/auto/qwidget/qwidget.pro b/tests/auto/qwidget/qwidget.pro
index 59c1753..def28f5 100644
--- a/tests/auto/qwidget/qwidget.pro
+++ b/tests/auto/qwidget/qwidget.pro
@@ -16,6 +16,7 @@ OBJECTIVE_SOURCES += tst_qwidget_mac_helpers.mm
symbian {
INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+ LIBS += -leikcore -lcone -leikcoctl
}
!wince*:!symbian:win32: LIBS += -luser32 -lgdi32
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index b94f381..230b7c9 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -74,6 +74,7 @@
#include <akntitle.h> // CAknTitlePane
#include <akncontext.h> // CAknContextPane
#include <eikspane.h> // CEikStatusPane
+#include <eikbtgpc.h> // CEikButtonGroupContainer
#endif
#ifdef Q_WS_QWS
@@ -366,6 +367,10 @@ private slots:
void setGraphicsEffect();
void destroyBackingStore();
+
+#ifdef Q_OS_SYMBIAN
+ void cbaVisibility();
+#endif
private:
bool ensureScreenSize(int width, int height);
@@ -9323,5 +9328,43 @@ void tst_QWidget::setGraphicsEffect()
delete anotherWidget;
}
+#ifdef Q_OS_SYMBIAN
+void tst_QWidget::cbaVisibility()
+{
+ // Test case for task 261048
+
+ // Create first mainwindow in fullsreen and activate it
+ QMainWindow* mainwindow = new QMainWindow();
+ QLabel* label = new QLabel(mainwindow);
+ mainwindow->setCentralWidget(label);
+ mainwindow->setWindowState(Qt::WindowFullScreen);
+ mainwindow->setVisible(true);
+ mainwindow->activateWindow();
+ qApp->processEvents();
+
+ QVERIFY(mainwindow->isActiveWindow());
+ QVERIFY(QDesktopWidget().availableGeometry().size() == mainwindow->size());
+
+ // Create second mainwindow in maximized and activate it
+ QMainWindow* mainwindow2 = new QMainWindow();
+ QLabel* label2 = new QLabel(mainwindow2);
+ mainwindow2->setCentralWidget(label2);
+ mainwindow2->setWindowState(Qt::WindowMaximized);
+ mainwindow2->setVisible(true);
+ mainwindow2->activateWindow();
+ qApp->processEvents();
+
+ QVERIFY(!mainwindow->isActiveWindow());
+ QVERIFY(mainwindow2->isActiveWindow());
+ QVERIFY(QDesktopWidget().availableGeometry().size() == mainwindow2->size());
+
+ // Verify window decorations i.e. status pane and CBA are visible.
+ CEikStatusPane* statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane();
+ QVERIFY(statusPane->IsVisible());
+ CEikButtonGroupContainer* buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba();
+ QVERIFY(buttonGroup->IsVisible());
+}
+#endif
+
QTEST_MAIN(tst_QWidget)
#include "tst_qwidget.moc"