summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2011-03-28 12:55:28 (GMT)
committerTimo Turunen <timo.p.turunen@nokia.com>2011-03-29 06:00:10 (GMT)
commitabc6e08c72427feea29c9826f72990f2c4e2565f (patch)
treee21e2d8d42002ef5745a797356b9619eb79f20dc
parent43a8e3115fc9d13c2da2f32c3d2aafcfe0c6e543 (diff)
downloadQt-abc6e08c72427feea29c9826f72990f2c4e2565f.zip
Qt-abc6e08c72427feea29c9826f72990f2c4e2565f.tar.gz
Qt-abc6e08c72427feea29c9826f72990f2c4e2565f.tar.bz2
Show softkeys when opening a dialog that has a fullscreen parent.
Now shows the CBA for each window that defines softkeys even if topmost parent is fullscreen. Task-number: QTBUG-4953 Reviewed-by: Sami Merila (cherry picked from commit 5a6acc0ba1ed3b056f4c7a9c37481f4cb347a352)
-rw-r--r--src/gui/kernel/qapplication_s60.cpp39
-rw-r--r--src/gui/kernel/qwidget_s60.cpp44
2 files changed, 64 insertions, 19 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index dd403d8..57dc218 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -1243,15 +1243,36 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */)
qwidget->d_func()->setWindowIcon_sys(true);
qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle());
#ifdef Q_WS_S60
- // If widget is fullscreen/minimized, hide status pane and button container otherwise show them.
- QWidget *const window = qwidget->window();
- if (!window->parentWidget()) { // Only top level native windows have control over cba/status pane
- const bool decorationsVisible = !(window->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized));
- const bool statusPaneVisibility = decorationsVisible;
- const bool isFullscreen = window->windowState() & Qt::WindowFullScreen;
- const bool cbaVisibilityHint = window->windowFlags() & Qt::WindowSoftkeysVisibleHint;
- const bool buttonGroupVisibility = (decorationsVisible || (isFullscreen && cbaVisibilityHint));
- S60->setStatusPaneAndButtonGroupVisibility(statusPaneVisibility, buttonGroupVisibility);
+ if (qwidget->isWindow()) {
+ QWidget *const window = qwidget->window();
+ QWidget *parentWindow = window->parentWidget();
+ if (parentWindow) {
+ while (parentWindow->parentWidget())
+ parentWindow = parentWindow->parentWidget();
+ } else {
+ parentWindow = window;
+ }
+
+ const bool parentDecorationsVisible = !(parentWindow->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized));
+ const bool parentIsFullscreen = parentWindow->windowState() & Qt::WindowFullScreen;
+ const bool parentCbaVisibilityHint = parentWindow->windowFlags() & Qt::WindowSoftkeysVisibleHint;
+ bool buttonGroupVisibility = (parentDecorationsVisible || (parentIsFullscreen && parentCbaVisibilityHint));
+
+ // For non-toplevel normal and maximized windows, show cba if window has softkey
+ // actions even if topmost parent is not showing cba. Do the same for fullscreen
+ // windows that request it.
+ if (!buttonGroupVisibility
+ && window->parentWidget()
+ && !(window->windowState() & Qt::WindowMinimized)
+ && ((window->windowFlags() & Qt::WindowSoftkeysVisibleHint) || !(window->windowState() & Qt::WindowFullScreen))) {
+ for (int i = 0; i < window->actions().size(); ++i) {
+ if (window->actions().at(i)->softKeyRole() != QAction::NoSoftKey) {
+ buttonGroupVisibility = true;
+ break;
+ }
+ }
+ }
+ S60->setStatusPaneAndButtonGroupVisibility(parentDecorationsVisible, buttonGroupVisibility);
}
#endif
} else if (QApplication::activeWindow() == qwidget->window()) {
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 1e0f1c1..d2bd614 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -1184,17 +1184,41 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
}
#ifdef Q_WS_S60
- bool decorationsVisible(false);
- if (!parentWidget()) { // Only top level native windows have control over cba/status pane
- // Hide window decoration when switching to fullscreen / minimized otherwise show decoration.
- // 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 unnecessary redraws
- decorationsVisible = !(newstate & (Qt::WindowFullScreen | Qt::WindowMinimized));
- const bool statusPaneVisibility = decorationsVisible;
- const bool buttonGroupVisibility = (decorationsVisible || (isFullscreen && cbaRequested));
- S60->setStatusPaneAndButtonGroupVisibility(statusPaneVisibility, buttonGroupVisibility);
+ // Hide window decoration when switching to fullscreen / minimized otherwise show decoration.
+ // 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 unnecessary redraws
+ Qt::WindowStates comparisonState = newstate;
+ QWidget *parentWindow = parentWidget();
+ if (parentWindow) {
+ while (parentWindow->parentWidget())
+ parentWindow = parentWindow->parentWidget();
+ comparisonState = parentWindow->windowState();
+ } else {
+ parentWindow = this;
+ }
+
+ const bool decorationsVisible = !(comparisonState & (Qt::WindowFullScreen | Qt::WindowMinimized));
+ const bool parentIsFullscreen = comparisonState & Qt::WindowFullScreen;
+ const bool parentCbaVisibilityHint = parentWindow->windowFlags() & Qt::WindowSoftkeysVisibleHint;
+ bool buttonGroupVisibility = (decorationsVisible || (parentIsFullscreen && parentCbaVisibilityHint));
+
+ // For non-toplevel normal and maximized windows, show cba if window has softkey
+ // actions even if topmost parent is not showing cba. Do the same for fullscreen
+ // windows that request it.
+ if (!buttonGroupVisibility
+ && parentWidget()
+ && !(newstate & Qt::WindowMinimized)
+ && ((windowFlags() & Qt::WindowSoftkeysVisibleHint) || !(newstate & Qt::WindowFullScreen))) {
+ for (int i = 0; i < actions().size(); ++i) {
+ if (actions().at(i)->softKeyRole() != QAction::NoSoftKey) {
+ buttonGroupVisibility = true;
+ break;
+ }
+ }
}
+ S60->setStatusPaneAndButtonGroupVisibility(decorationsVisible, buttonGroupVisibility);
+
#endif // Q_WS_S60
// Ensure the initial size is valid, since we store it as normalGeometry below.