summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/widgets/softkeys/softkeys.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/examples/widgets/softkeys/softkeys.cpp b/examples/widgets/softkeys/softkeys.cpp
index 9672aee..e717510 100644
--- a/examples/widgets/softkeys/softkeys.cpp
+++ b/examples/widgets/softkeys/softkeys.cpp
@@ -127,7 +127,9 @@ void MainWindow::addSoftKeys()
QList<QAction*> softkeys;
softkeys.append(ok);
softkeys.append(cancel);
- pushButton->setSoftKeys(softkeys);
+ QWidget* focusWidget = QApplication::focusWidget();
+ if (focusWidget)
+ focusWidget->setSoftKeys(softkeys);
}
void MainWindow::exitApplication()
@@ -138,13 +140,17 @@ void MainWindow::exitApplication()
void MainWindow::okPressed()
{
infoLabel->setText(tr("OK pressed"));
- pushButton->setSoftKey(0);
+ QWidget* focusWidget = QApplication::focusWidget();
+ if (focusWidget)
+ focusWidget->setSoftKey(0);
}
void MainWindow::cancelPressed()
{
infoLabel->setText(tr("Cancel pressed"));
- pushButton->setSoftKey(0);
+ QWidget* focusWidget = QApplication::focusWidget();
+ if (focusWidget)
+ focusWidget->setSoftKey(0);
}