summaryrefslogtreecommitdiffstats
path: root/examples/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets')
-rw-r--r--examples/widgets/softkeys/softkeys.cpp35
1 files changed, 14 insertions, 21 deletions
diff --git a/examples/widgets/softkeys/softkeys.cpp b/examples/widgets/softkeys/softkeys.cpp
index c026d15..5d624ef 100644
--- a/examples/widgets/softkeys/softkeys.cpp
+++ b/examples/widgets/softkeys/softkeys.cpp
@@ -55,10 +55,16 @@ MainWindow::MainWindow(QWidget *parent)
QAction* clear = new QAction(tr("Clear"), this);
clear->setSoftKeyRole(QAction::CancelSoftKey);
- QList<QAction*> textEditorSoftKeys;
- textEditorSoftKeys.append(menu);
- textEditorSoftKeys.append(clear);
- textEditor->setSoftKeys(textEditorSoftKeys);
+ textEditor->addAction(menu);
+ textEditor->addAction(clear);
+
+ ok = new QAction(tr("Ok"), this);
+ ok->setSoftKeyRole(QAction::OkSoftKey);
+ connect(ok, SIGNAL(triggered()), this, SLOT(okPressed()));
+
+ cancel = new QAction(tr("Cancel"), this);
+ cancel->setSoftKeyRole(QAction::CancelSoftKey);
+ connect(cancel, SIGNAL(triggered()), this, SLOT(cancelPressed()));
infoLabel = new QLabel(tr(""), this);
infoLabel->setContextMenuPolicy(Qt::NoContextMenu);
@@ -113,20 +119,8 @@ void MainWindow::openDialog()
void MainWindow::addSoftKeys()
{
- ok = new QAction(tr("Ok"), this);
- ok->setSoftKeyRole(QAction::OkSoftKey);
- connect(ok, SIGNAL(triggered()), this, SLOT(okPressed()));
-
- cancel = new QAction(tr("Cancel"), this);
- cancel->setSoftKeyRole(QAction::CancelSoftKey);
- connect(cancel, SIGNAL(triggered()), this, SLOT(cancelPressed()));
-
- QList<QAction*> softkeys;
- softkeys.append(ok);
- softkeys.append(cancel);
- QWidget* focusWidget = QApplication::focusWidget();
- if (focusWidget)
- focusWidget->setSoftKeys(softkeys);
+ addAction(ok);
+ addAction(cancel);
}
void MainWindow::setCustomSoftKeys()
@@ -137,9 +131,8 @@ void MainWindow::setCustomSoftKeys()
}
else {
infoLabel->setText(tr("Custom softkeys removed"));
- QWidget* focusWidget = QApplication::focusWidget();
- if (focusWidget)
- focusWidget->setSoftKey(0);
+ removeAction(ok);
+ removeAction(cancel);
}
}