diff options
author | Alessandro Portale <aportale@trolltech.com> | 2009-05-25 16:14:39 (GMT) |
---|---|---|
committer | Alessandro Portale <aportale@trolltech.com> | 2009-05-25 17:14:10 (GMT) |
commit | a4fd37805642f092942b7a761cd50991cc6d7d34 (patch) | |
tree | 2707597b0816a37be67b70d63cbadacc2949d2fd /src | |
parent | b23dc7fb8bc8de6617684249411b5399f1d06631 (diff) | |
download | Qt-a4fd37805642f092942b7a761cd50991cc6d7d34.zip Qt-a4fd37805642f092942b7a761cd50991cc6d7d34.tar.gz Qt-a4fd37805642f092942b7a761cd50991cc6d7d34.tar.bz2 |
Providing a translated default text for standard roles.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/qsoftkeyaction.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/gui/widgets/qsoftkeyaction.cpp b/src/gui/widgets/qsoftkeyaction.cpp index 583cf65..302850c 100644 --- a/src/gui/widgets/qsoftkeyaction.cpp +++ b/src/gui/widgets/qsoftkeyaction.cpp @@ -55,12 +55,40 @@ public: this->role = role; } + static QString roleText(QSoftKeyAction::StandardRole role); + QSoftKeyAction::StandardRole role; QString roleName; int nativePosition; int qtContextKey; }; +QString QSoftKeyActionPrivate::roleText(QSoftKeyAction::StandardRole role) +{ + switch (role) { + case QSoftKeyAction::Options: + return QSoftKeyAction::tr("Options"); + case QSoftKeyAction::Select: + return QSoftKeyAction::tr("Select"); + case QSoftKeyAction::Back: + return QSoftKeyAction::tr("Back"); + case QSoftKeyAction::Next: + return QSoftKeyAction::tr("Next"); + case QSoftKeyAction::Previous: + return QSoftKeyAction::tr("Previous"); + case QSoftKeyAction::Ok: + return QSoftKeyAction::tr("Ok"); + case QSoftKeyAction::Cancel: + return QSoftKeyAction::tr("Cancel"); + case QSoftKeyAction::Edit: + return QSoftKeyAction::tr("Edit"); + case QSoftKeyAction::View: + return QSoftKeyAction::tr("View"); + default: + return QString(); + }; +} + /*! \enum QSoftKeyAction::StandardRole This enum defines the standard role for a QSoftKeyAction. @@ -92,6 +120,7 @@ QSoftKeyAction::QSoftKeyAction(StandardRole role, QObject *parent) { Q_D(QSoftKeyAction); d->role = role; + setText(QSoftKeyActionPrivate::roleText(role)); } QSoftKeyAction::QSoftKeyAction(const QString &text, QObject* parent) |