diff -r 41300fa6a67c -r f7bc934e204c examples/widgets/softkeys/softkeys.cpp --- a/examples/widgets/softkeys/softkeys.cpp Tue Feb 02 00:43:10 2010 +0200 +++ b/examples/widgets/softkeys/softkeys.cpp Wed Mar 31 11:06:36 2010 +0300 @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -70,6 +70,12 @@ 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 @@ 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 @@ 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::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();