summaryrefslogtreecommitdiffstats
path: root/examples/widgets/softkeys/softkeys.cpp
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2010-03-08 01:43:00 (GMT)
committerBea Lam <bea.lam@nokia.com>2010-03-08 01:43:00 (GMT)
commit56768688cc49c2dd2234598b41ebbfd046937ac5 (patch)
tree029ced5da670e8b64901827508502454e0a167aa /examples/widgets/softkeys/softkeys.cpp
parent038f6fc10092da1414fd2efff353671dbf862995 (diff)
parent9bc81769eb6ebc9bd62fe3c1d86e67ddccbed8b6 (diff)
downloadQt-56768688cc49c2dd2234598b41ebbfd046937ac5.zip
Qt-56768688cc49c2dd2234598b41ebbfd046937ac5.tar.gz
Qt-56768688cc49c2dd2234598b41ebbfd046937ac5.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'examples/widgets/softkeys/softkeys.cpp')
-rw-r--r--examples/widgets/softkeys/softkeys.cpp38
1 files changed, 38 insertions, 0 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();