diff options
author | Jason Barron <jbarron@trolltech.com> | 2009-09-20 10:55:36 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2009-09-21 08:07:50 (GMT) |
commit | 7bb16c92a29d316b0dc385e95d99d3edfd1b4196 (patch) | |
tree | 462d020724be4048a6cc6738d55f6dd34db2f445 /src/gui/widgets | |
parent | f01dd45eb52e6a9d76fbd2645466cc52319715a0 (diff) | |
download | Qt-7bb16c92a29d316b0dc385e95d99d3edfd1b4196.zip Qt-7bb16c92a29d316b0dc385e95d99d3edfd1b4196.tar.gz Qt-7bb16c92a29d316b0dc385e95d99d3edfd1b4196.tar.bz2 |
Simplify the soft key roles of QAction.
Previously there were many options here that were inherited from the
Qtopia implementation. It was not clear to developers which value
they actually should use. A good example was the 'Next' value. In
a typical wizard application, next would be on the right and
'Previous' would be on the left. However, it is also common to have
'Next' on the left and have 'Cancel' on the right.
Basically what people really wanted was a way to explicitly set the
right and left soft keys, but since this relies on form factor and
is wrong if the screen is rotated, we choose positive and negative
actions as the values for these such that they still make sense when
the screen is rotated. Also this helps people who don't know if a
particular action should be on the left or right, but they *do* know
if their action has destructive characterisitics (negative).
As a convenience for widgets in Qt that use softkeys, we create a
standard softkey enumeration. That maps the actions to the correct
role and has default text.
Reviewed-by: Alessandro Portale
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/qcombobox.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/qdialogbuttonbox.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/qmainwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/qmenu.cpp | 6 |
4 files changed, 8 insertions, 8 deletions
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index 2f79600..61532b9 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -403,8 +403,8 @@ QComboBoxPrivateContainer::QComboBoxPrivateContainer(QAbstractItemView *itemView layout->setMargin(0); #ifdef QT_SOFTKEYS_ENABLED - selectAction = QSoftKeyManager::createKeyedAction(QAction::SelectSoftKey, Qt::Key_Select, itemView); - cancelAction = QSoftKeyManager::createKeyedAction(QAction::CancelSoftKey, Qt::Key_Escape, itemView); + selectAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::SelectSoftKey, Qt::Key_Select, itemView); + cancelAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::CancelSoftKey, Qt::Key_Escape, itemView); addAction(selectAction); addAction(cancelAction); #endif diff --git a/src/gui/widgets/qdialogbuttonbox.cpp b/src/gui/widgets/qdialogbuttonbox.cpp index 2ceeca7..39566ef 100644 --- a/src/gui/widgets/qdialogbuttonbox.cpp +++ b/src/gui/widgets/qdialogbuttonbox.cpp @@ -580,13 +580,13 @@ QAction* QDialogButtonBoxPrivate::createSoftKey(QAbstractButton *button, QDialog case YesRole: case ActionRole: case HelpRole: - softkeyRole = QAction::OkSoftKey; + softkeyRole = QAction::PositiveSoftKey; break; case RejectRole: case DestructiveRole: case NoRole: case ResetRole: - softkeyRole = QAction::CancelSoftKey; + softkeyRole = QAction::NegativeSoftKey; break; default: break; diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index 8a39a48..8bdbba7 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -118,7 +118,7 @@ void QMainWindowPrivate::init() iconSize = QSize(metric, metric); q->setAttribute(Qt::WA_Hover); #ifdef QT_SOFTKEYS_ENABLED - menuBarAction = QSoftKeyManager::createAction(QAction::MenuSoftKey, q); + menuBarAction = QSoftKeyManager::createAction(QSoftKeyManager::DoneSoftKey, q); #endif } diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 5e51155..687e1bc 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -163,9 +163,9 @@ void QMenuPrivate::init() scroll->scrollFlags = QMenuPrivate::QMenuScroller::ScrollNone; } -#ifdef QT_KEYPAD_NAVIGATION - selectAction = QSoftKeyManager::createKeyedAction(QAction::SelectSoftKey, Qt::Key_Select, q); - cancelAction = QSoftKeyManager::createKeyedAction(QAction::CancelSoftKey, Qt::Key_Back, q); +#ifdef QT_SOFTKEYS_ENABLED + selectAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::SelectSoftKey, Qt::Key_Select, q); + cancelAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::CancelSoftKey, Qt::Key_Back, q); selectAction->setVisible(false); // Don't show these in the menu cancelAction->setVisible(false); q->addAction(selectAction); |