| ID | ... | Creation date | July 1, 2009 |
| Platform | S60 3rd Edition, FP1, FP2 S60 5th Edition | Tested on devices | Nokia 5800 XpressMusic |
| Category | Qt for Symbian | Subcategory | UI |
| Keywords (APIs, classes, methods, functions): QWidget::setSoftKeys() |
This code snippets shows how to change SoftKeyLabels of widget. Qt S60 Tower release added API for setting softkeys. QWidget::setSoftKeys() set the soft key label based on keyroles.
This snippet can be self-signed. As it does not use any API which require developer/certified signing.
QWidget* centralwidget = new QWidget(this);
centralwidget->setContextMenuPolicy(Qt::NoContextMenu);
setCentralWidget(centralwidget);
/* Add new softkey "MyOption" */
QAction* newOption = new QAction(tr("MyOption"), this);
/* set soft key for Options */
newOption->setSoftKeyRole(QAction::OptionsSoftKey);
/* Add new softkey "MyOption" */
QAction* newExit = new QAction(tr("MyExit"), this);
/* set soft key for Exit */
newExit->setSoftKeyRole(QAction::ExitSoftKey);
QList<QAction *> softKeys;
softKeys.append(newOption);
softKeys.append(newExit);
/* set new soft keys */
centralwidget->setSoftKeys(softKeys);
centralwidget->setFocus();
The code snippet is expected to show new softkey labels in Widget.
No related wiki articles found