summaryrefslogtreecommitdiffstats
path: root/examples
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 /examples
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 'examples')
-rw-r--r--examples/widgets/softkeys/softkeys.cpp38
-rw-r--r--examples/widgets/softkeys/softkeys.h19
-rw-r--r--examples/widgets/windowflags/controllerwindow.cpp4
3 files changed, 51 insertions, 10 deletions
diff --git a/examples/widgets/softkeys/softkeys.cpp b/examples/widgets/softkeys/softkeys.cpp
index cbd227c9..e5c2e73 100644
--- a/examples/widgets/softkeys/softkeys.cpp
+++ b/examples/widgets/softkeys/softkeys.cpp
@@ -70,6 +70,12 @@ MainWindow::MainWindow(QWidget *parent)
toggleButton->setContextMenuPolicy(Qt::NoContextMenu);
toggleButton->setCheckable(true);
+ modeButton = new QPushButton(tr("Loop SK window type"), this);
+ modeButton->setContextMenuPolicy(Qt::NoContextMenu);
+
+ modeLabel = new QLabel(tr("Normal maximized"), this);
+ modeLabel->setContextMenuPolicy(Qt::NoContextMenu);
+
pushButton = new QPushButton(tr("File Dialog"), this);
pushButton->setContextMenuPolicy(Qt::NoContextMenu);
@@ -87,6 +93,8 @@ MainWindow::MainWindow(QWidget *parent)
layout->addWidget(toggleButton, 2, 0);
layout->addWidget(pushButton, 2, 1);
layout->addWidget(comboBox, 3, 0, 1, 2);
+ layout->addWidget(modeButton, 4, 0, 1, 2);
+ layout->addWidget(modeLabel, 5, 0, 1, 2);
central->setLayout(layout);
fileMenu = menuBar()->addMenu(tr("&File"));
@@ -97,6 +105,7 @@ MainWindow::MainWindow(QWidget *parent)
connect(pushButton, SIGNAL(clicked()), this, SLOT(openDialog()));
connect(exit, SIGNAL(triggered()), this, SLOT(exitApplication()));
connect(toggleButton, SIGNAL(clicked()), this, SLOT(setCustomSoftKeys()));
+ connect(modeButton, SIGNAL(clicked()), this, SLOT(setMode()));
pushButton->setFocus();
}
@@ -133,6 +142,35 @@ void MainWindow::setCustomSoftKeys()
}
}
+void MainWindow::setMode()
+{
+ if(isMaximized()) {
+ showFullScreen();
+ modeLabel->setText(tr("Normal Fullscreen"));
+ } else {
+ Qt::WindowFlags flags = windowFlags();
+ if(flags & Qt::WindowSoftkeysRespondHint) {
+ flags |= Qt::WindowSoftkeysVisibleHint;
+ flags &= ~Qt::WindowSoftkeysRespondHint;
+ setWindowFlags(flags); // Hides visible window
+ showFullScreen();
+ modeLabel->setText(tr("Fullscreen with softkeys"));
+ } else if(flags & Qt::WindowSoftkeysVisibleHint) {
+ flags &= ~Qt::WindowSoftkeysVisibleHint;
+ flags &= ~Qt::WindowSoftkeysRespondHint;
+ setWindowFlags(flags); // Hides visible window
+ showMaximized();
+ modeLabel->setText(tr("Normal Maximized"));
+ } else {
+ flags &= ~Qt::WindowSoftkeysVisibleHint;
+ flags |= Qt::WindowSoftkeysRespondHint;
+ setWindowFlags(flags); // Hides visible window
+ showFullScreen();
+ modeLabel->setText(tr("Fullscreen with SK respond"));
+ }
+ }
+}
+
void MainWindow::exitApplication()
{
qApp->exit();
diff --git a/examples/widgets/softkeys/softkeys.h b/examples/widgets/softkeys/softkeys.h
index bae31e7..d533484 100644
--- a/examples/widgets/softkeys/softkeys.h
+++ b/examples/widgets/softkeys/softkeys.h
@@ -57,21 +57,24 @@ private slots:
void okPressed();
void cancelPressed();
void setCustomSoftKeys();
+ void setMode();
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
private:
QGridLayout *layout;
QWidget *central;
- QTextEdit* textEditor;
+ QTextEdit *textEditor;
QLabel *infoLabel;
- QPushButton* toggleButton;
- QPushButton* pushButton;
- QMenu* fileMenu;
- QAction* addSoftKeysAct;
- QAction* exit;
- QAction* ok;
- QAction* cancel;
+ QPushButton *toggleButton;
+ QPushButton *pushButton;
+ QPushButton *modeButton;
+ QLabel *modeLabel;
+ QMenu *fileMenu;
+ QAction *addSoftKeysAct;
+ QAction *exit;
+ QAction *ok;
+ QAction *cancel;
};
//! [0]
diff --git a/examples/widgets/windowflags/controllerwindow.cpp b/examples/widgets/windowflags/controllerwindow.cpp
index 0277794..a1e5455 100644
--- a/examples/widgets/windowflags/controllerwindow.cpp
+++ b/examples/widgets/windowflags/controllerwindow.cpp
@@ -58,7 +58,7 @@ ControllerWindow::ControllerWindow()
bottomLayout->addStretch();
bottomLayout->addWidget(quitButton);
- QVBoxLayout *mainLayout = new QVBoxLayout;
+ QHBoxLayout *mainLayout = new QHBoxLayout;
mainLayout->addWidget(typeGroupBox);
mainLayout->addWidget(hintsGroupBox);
mainLayout->addLayout(bottomLayout);
@@ -149,7 +149,7 @@ void ControllerWindow::createTypeGroupBox()
splashScreenRadioButton = createRadioButton(tr("Splash screen"));
windowRadioButton->setChecked(true);
- QGridLayout *layout = new QGridLayout;
+ QVBoxLayout *layout = new QGridLayout;
layout->addWidget(windowRadioButton, 0, 0);
layout->addWidget(dialogRadioButton, 1, 0);
layout->addWidget(sheetRadioButton, 2, 0);