summaryrefslogtreecommitdiffstats
path: root/examples/widgets/softkeys/softkeys.cpp
diff options
context:
space:
mode:
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();