summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkku Luukkainen <markku.luukkainen@digia.com>2009-06-06 11:09:26 (GMT)
committerMarkku Luukkainen <markku.luukkainen@digia.com>2009-06-06 11:09:26 (GMT)
commitb8d6e02fc73fec1c1bc6b5b21e80104be61b946e (patch)
tree9ac5c61a690040ea9451e2686c3dcf6cafd6218e
parentdfffbd4d134f9b8adc75b2c33c31a2ee859903e6 (diff)
downloadQt-b8d6e02fc73fec1c1bc6b5b21e80104be61b946e.zip
Qt-b8d6e02fc73fec1c1bc6b5b21e80104be61b946e.tar.gz
Qt-b8d6e02fc73fec1c1bc6b5b21e80104be61b946e.tar.bz2
Added SoftKeyRole
-rw-r--r--src/gui/kernel/qaction.cpp25
-rw-r--r--src/gui/kernel/qaction.h9
-rw-r--r--src/gui/kernel/qaction_p.h1
3 files changed, 35 insertions, 0 deletions
diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp
index abb17d7..e32416a 100644
--- a/src/gui/kernel/qaction.cpp
+++ b/src/gui/kernel/qaction.cpp
@@ -1348,6 +1348,31 @@ QAction::MenuRole QAction::menuRole() const
}
/*!
+ \property QAction::softKeyRole
+ \brief the action's softkey role
+ \since 4.6
+
+ This indicates what softkey action this action is. Usually used on mobile
+ platforms to map QActions no hardware keys.
+
+ The softkey role can be changed any time.
+*/
+void QAction::setSoftKeyRole(SoftKeyRole softKeyRole)
+{
+ Q_D(QAction);
+ if (d->softKeyRole == softKeyRole)
+ return;
+
+ d->softKeyRole = softKeyRole;
+ d->sendDataChanged();
+}
+
+QAction::SoftKeyRole QAction::softKeyRole() const
+{
+ Q_D(const QAction);
+ return d->softKeyRole;
+}
+/*!
\property QAction::iconVisibleInMenu
\brief Whether or not an action should show an icon in a menu
\since 4.4
diff --git a/src/gui/kernel/qaction.h b/src/gui/kernel/qaction.h
index d7bf8c3..e9c64c8 100644
--- a/src/gui/kernel/qaction.h
+++ b/src/gui/kernel/qaction.h
@@ -67,6 +67,7 @@ class Q_GUI_EXPORT QAction : public QObject
Q_DECLARE_PRIVATE(QAction)
Q_ENUMS(MenuRole)
+ Q_ENUMS(SoftKeyRole)
Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable)
Q_PROPERTY(bool checked READ isChecked WRITE setChecked DESIGNABLE isCheckable NOTIFY toggled)
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
@@ -84,11 +85,16 @@ class Q_GUI_EXPORT QAction : public QObject
#endif
Q_PROPERTY(bool visible READ isVisible WRITE setVisible)
Q_PROPERTY(MenuRole menuRole READ menuRole WRITE setMenuRole)
+ Q_PROPERTY(SoftKeyRole softKeyRole READ softKeyRole WRITE setSoftKeyRole)
Q_PROPERTY(bool iconVisibleInMenu READ isIconVisibleInMenu WRITE setIconVisibleInMenu)
public:
enum MenuRole { NoRole, TextHeuristicRole, ApplicationSpecificRole, AboutQtRole,
AboutRole, PreferencesRole, QuitRole };
+ enum SoftKeyRole { Options, Select, Back, Next, Previous, Ok, Cancel, Edit,
+ View, BackSpace, EndEdit, RevertEdit, Deselect, Finish, Menu,
+ ContextMenu, Custom, SoftKey1, SoftKey2, SoftKey3, SoftKey4 };
+
explicit QAction(QObject* parent);
QAction(const QString &text, QObject* parent);
QAction(const QIcon &icon, const QString &text, QObject* parent);
@@ -168,6 +174,9 @@ public:
void setMenuRole(MenuRole menuRole);
MenuRole menuRole() const;
+ void setSoftKeyRole(SoftKeyRole softKeyRole);
+ SoftKeyRole softKeyRole() const;
+
void setIconVisibleInMenu(bool visible);
bool isIconVisibleInMenu() const;
diff --git a/src/gui/kernel/qaction_p.h b/src/gui/kernel/qaction_p.h
index 0617ef5..6051d9a 100644
--- a/src/gui/kernel/qaction_p.h
+++ b/src/gui/kernel/qaction_p.h
@@ -102,6 +102,7 @@ public:
uint separator : 1;
uint fontSet : 1;
QAction::MenuRole menuRole;
+ QAction::SoftKeyRole softKeyRole;
int iconVisibleInMenu : 3; // Only has values -1, 0, and 1
QList<QWidget *> widgets;
#ifndef QT_NO_GRAPHICSVIEW