Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.3 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/examples/widgets/softkeys/softkeys.cpp

    r651 r769  
    7171    toggleButton->setCheckable(true);
    7272
     73    modeButton = new QPushButton(tr("Loop SK window type"), this);
     74    modeButton->setContextMenuPolicy(Qt::NoContextMenu);
     75
     76    modeLabel = new QLabel(tr("Normal maximized"), this);
     77    modeLabel->setContextMenuPolicy(Qt::NoContextMenu);
     78
    7379    pushButton = new QPushButton(tr("File Dialog"), this);
    7480    pushButton->setContextMenuPolicy(Qt::NoContextMenu);
     
    8894    layout->addWidget(pushButton, 2, 1);
    8995    layout->addWidget(comboBox, 3, 0, 1, 2);
     96    layout->addWidget(modeButton, 4, 0, 1, 2);
     97    layout->addWidget(modeLabel, 5, 0, 1, 2);
    9098    central->setLayout(layout);
    9199
     
    98106    connect(exit, SIGNAL(triggered()), this, SLOT(exitApplication()));
    99107    connect(toggleButton, SIGNAL(clicked()), this, SLOT(setCustomSoftKeys()));
     108    connect(modeButton, SIGNAL(clicked()), this, SLOT(setMode()));
    100109    pushButton->setFocus();
    101110}
     
    134143}
    135144
     145void MainWindow::setMode()
     146{
     147    if(isMaximized()) {
     148        showFullScreen();
     149        modeLabel->setText(tr("Normal Fullscreen"));
     150    } else {
     151        Qt::WindowFlags flags = windowFlags();
     152        if(flags & Qt::WindowSoftkeysRespondHint) {
     153            flags |= Qt::WindowSoftkeysVisibleHint;
     154            flags &= ~Qt::WindowSoftkeysRespondHint;
     155            setWindowFlags(flags); // Hides visible window
     156            showFullScreen();
     157            modeLabel->setText(tr("Fullscreen with softkeys"));
     158        } else if(flags & Qt::WindowSoftkeysVisibleHint) {
     159            flags &= ~Qt::WindowSoftkeysVisibleHint;
     160            flags &= ~Qt::WindowSoftkeysRespondHint;
     161            setWindowFlags(flags); // Hides visible window
     162            showMaximized();
     163            modeLabel->setText(tr("Normal Maximized"));
     164        } else {
     165            flags &= ~Qt::WindowSoftkeysVisibleHint;
     166            flags |= Qt::WindowSoftkeysRespondHint;
     167            setWindowFlags(flags); // Hides visible window
     168            showFullScreen();
     169            modeLabel->setText(tr("Fullscreen with SK respond"));
     170        }
     171    }
     172}
     173
    136174void MainWindow::exitApplication()
    137175{
Note: See TracChangeset for help on using the changeset viewer.