summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwidget_s60.cpp
diff options
context:
space:
mode:
authorJanne Anttila <janne.anttila@digia.com>2010-03-01 07:41:55 (GMT)
committerJanne Anttila <janne.anttila@digia.com>2010-03-01 08:22:11 (GMT)
commit1d8b860694c121527b1f964e1090aa2d1987075e (patch)
tree0645acef6eb4266d06d76ea972295a927e6790b0 /src/gui/kernel/qwidget_s60.cpp
parentfb7204725ce88f175de6fa986296b42000e692c0 (diff)
downloadQt-1d8b860694c121527b1f964e1090aa2d1987075e.zip
Qt-1d8b860694c121527b1f964e1090aa2d1987075e.tar.gz
Qt-1d8b860694c121527b1f964e1090aa2d1987075e.tar.bz2
Added fullscreen support to softkeys in Symbian.
This commit enables the following two features: 1. Developer can make softkeys visible in fullscreen widget by setting the Qt::WindowSoftkeysVisibleHint window flag. This flag implememts intermediate mode for maximized and fullscreen modes. In maximized mode both statuspane and softkeys are visible, in fullscreen mode with WindowSoftkeysVisibleHint flag, only the softkeys are visible and in normal fullscreen mode both statuspane and softkeys are invisible. This feature was requested by QTBUG-5171. 2. Developer can make softkeys to respond to the key events even the softkeys are invisible. This means that when widget with Qt::WindowSoftkeysRespondHint window flag is shown in fullsreen, the softkey HW key events are routed to invisible softkeys and softkeys trigger the action associated to pressed softkey button. If the flag is not set, the key event will be passed to application/focused widget normally and softkey actions are not triggered. This feature was requested in QTBUG-4564. Both new flags are by default off. In addition, the softkey example is updated to demonstrate the new window flags. The commit also contains some code style fixes applied by my editor automatically to changed files. Task-number: QTBUG-5171 Task-number: QTBUG-4564 Reviewed-by: Jason Barron
Diffstat (limited to 'src/gui/kernel/qwidget_s60.cpp')
-rw-r--r--src/gui/kernel/qwidget_s60.cpp35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index ebd289c..7bbc142 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -1042,7 +1042,13 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
Q_D(QWidget);
Qt::WindowStates oldstate = windowState();
- if (oldstate == newstate)
+
+ const TBool isFullscreen = newstate & Qt::WindowFullScreen;
+ const TBool cbaRequested = windowFlags() & Qt::WindowSoftkeysVisibleHint;
+ const TBool cbaVisible = CEikButtonGroupContainer::Current() ? true : false;
+ const TBool softkeyVisibilityChange = isFullscreen && (cbaRequested != cbaVisible);
+
+ if (oldstate == newstate && !softkeyVisibilityChange)
return;
if (isWindow()) {
@@ -1058,16 +1064,27 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
#ifdef Q_WS_S60
// Hide window decoration when switching to fullsccreen / 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
+ // 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
- CEikStatusPane* statusPane = S60->statusPane();
- CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer();
- TBool visible = !(newstate & (Qt::WindowFullScreen | Qt::WindowMinimized));
+ CEikStatusPane *statusPane = S60->statusPane();
+ CEikButtonGroupContainer *buttonGroup = S60->buttonGroupContainer();
+ TBool visible = !(newstate & (Qt::WindowFullScreen | Qt::WindowMinimized));
if (statusPane)
statusPane->MakeVisible(visible);
- if (buttonGroup)
- buttonGroup->MakeVisible(visible);
+ if (buttonGroup) {
+ // Visibility
+ buttonGroup->MakeVisible(visible || (isFullscreen && cbaRequested));
+
+ // Responsiviness
+ CEikCba *cba = static_cast<CEikCba *>( buttonGroup->ButtonGroup() ); // downcast from MEikButtonGroup
+ TUint cbaFlags = cba->ButtonGroupFlags();
+ if(windowFlags() & Qt::WindowSoftkeysRespondHint)
+ cbaFlags |= EAknCBAFlagRespondWhenInvisible;
+ else
+ cbaFlags &= ~EAknCBAFlagRespondWhenInvisible;
+ cba->SetButtonGroupFlags(cbaFlags);
+ }
#endif // Q_WS_S60
createWinId();
@@ -1080,7 +1097,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
const QRect normalGeometry = (top->normalGeometry.width() < 0) ? geometry() : top->normalGeometry;
if (newstate & Qt::WindowFullScreen)
- setGeometry(qApp->desktop()->screenGeometry(this));
+ setGeometry(qApp->desktop()->availableGeometry(this));
else if (newstate & Qt::WindowMaximized)
setGeometry(qApp->desktop()->availableGeometry(this));
else