diff options
author | Markku Luukkainen <markku.luukkainen@digia.com> | 2009-06-06 19:38:17 +0200 |
---|---|---|
committer | Markku Luukkainen <markku.luukkainen@digia.com> | 2009-06-06 19:38:17 +0200 |
commit | 5edc6f4e88aa7896be0e69a6bcf2365adb6b70b4 (patch) | |
tree | a205c74c21df7a8ba61558b4156e4be10affbd86 /src | |
parent | ef0f6267822c782f0b555e15ddab24c41c51d2e8 (diff) | |
download | qt4-tools-5edc6f4e88aa7896be0e69a6bcf2365adb6b70b4.tar.gz |
Added implementation to get default role names
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/qkeyeventsoftkey.cpp | 26 | ||||
-rw-r--r-- | src/gui/widgets/qkeyeventsoftkey.h | 1 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/gui/widgets/qkeyeventsoftkey.cpp b/src/gui/widgets/qkeyeventsoftkey.cpp index 08f5c6f3c2..bb236cc144 100644 --- a/src/gui/widgets/qkeyeventsoftkey.cpp +++ b/src/gui/widgets/qkeyeventsoftkey.cpp @@ -53,10 +53,36 @@ QKeyEventSoftKey::QKeyEventSoftKey(QAction *softKeyAction, Qt::Key key, QObject } +QString QKeyEventSoftKey::roleText(QAction::SoftKeyRole role) +{ + switch (role) { + case QAction::OptionsSoftKey: + return QAction::tr("Options"); + case QAction::SelectSoftKey: + return QAction::tr("Select"); + case QAction::BackSoftKey: + return QAction::tr("Back"); + case QAction::NextSoftKey: + return QAction::tr("Next"); + case QAction::PreviousSoftKey: + return QAction::tr("Previous"); + case QAction::OkSoftKey: + return QAction::tr("Ok"); + case QAction::CancelSoftKey: + return QAction::tr("Cancel"); + case QAction::EditSoftKey: + return QAction::tr("Edit"); + case QAction::ViewSoftKey: + return QAction::tr("View"); + default: + return QString(); + }; +} void QKeyEventSoftKey::addSoftKey(QAction::SoftKeyRole standardRole, Qt::Key key, QWidget *actionWidget) { QAction *action = new QAction(actionWidget); action->setSoftKeyRole(standardRole); + action->setText(roleText(standardRole)); QKeyEventSoftKey *softKey = new QKeyEventSoftKey(action, key, actionWidget); connect(action, SIGNAL(triggered()), softKey, SLOT(sendKeyEvent())); connect(action, SIGNAL(destroyed()), softKey, SLOT(deleteLater())); diff --git a/src/gui/widgets/qkeyeventsoftkey.h b/src/gui/widgets/qkeyeventsoftkey.h index fd69907421..83449c7538 100644 --- a/src/gui/widgets/qkeyeventsoftkey.h +++ b/src/gui/widgets/qkeyeventsoftkey.h @@ -57,6 +57,7 @@ class Q_GUI_EXPORT QKeyEventSoftKey : QObject Q_OBJECT public: QKeyEventSoftKey(QAction *softKeyAction, Qt::Key key, QObject *parent); + static QString roleText(QAction::SoftKeyRole role); static void addSoftKey(QAction::SoftKeyRole standardRole, Qt::Key key, QWidget *actionWidget); static void removeSoftkey(QWidget *focussedWidget); private: |