summaryrefslogtreecommitdiffstats
path: root/src/gui/dialogs
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-09-20 10:55:36 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-09-21 08:07:50 (GMT)
commit7bb16c92a29d316b0dc385e95d99d3edfd1b4196 (patch)
tree462d020724be4048a6cc6738d55f6dd34db2f445 /src/gui/dialogs
parentf01dd45eb52e6a9d76fbd2645466cc52319715a0 (diff)
downloadQt-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/dialogs')
-rw-r--r--src/gui/dialogs/qerrormessage.cpp2
-rw-r--r--src/gui/dialogs/qprogressdialog.cpp2
-rw-r--r--src/gui/dialogs/qwizard.cpp23
3 files changed, 7 insertions, 20 deletions
diff --git a/src/gui/dialogs/qerrormessage.cpp b/src/gui/dialogs/qerrormessage.cpp
index 78b5529..436ef94 100644
--- a/src/gui/dialogs/qerrormessage.cpp
+++ b/src/gui/dialogs/qerrormessage.cpp
@@ -247,7 +247,7 @@ QErrorMessage::QErrorMessage(QWidget * parent)
d->icon = new QLabel(this);
#ifdef QT_SOFTKEYS_ENABLED
d->okAction = new QAction(this);
- d->okAction->setSoftKeyRole(QAction::OkSoftKey);
+ d->okAction->setSoftKeyRole(QAction::PositiveSoftKey);
connect(d->okAction, SIGNAL(triggered()), this, SLOT(accept()));
addAction(d->okAction);
#endif
diff --git a/src/gui/dialogs/qprogressdialog.cpp b/src/gui/dialogs/qprogressdialog.cpp
index 292e950..5fb10bf 100644
--- a/src/gui/dialogs/qprogressdialog.cpp
+++ b/src/gui/dialogs/qprogressdialog.cpp
@@ -454,7 +454,7 @@ void QProgressDialog::setCancelButton(QPushButton *cancelButton)
#else
{
d->cancelAction = new QAction(cancelButton->text(), this);
- d->cancelAction->setSoftKeyRole(QAction::CancelSoftKey);
+ d->cancelAction->setSoftKeyRole(QAction::NegativeSoftKey);
connect(d->cancelAction, SIGNAL(triggered()), this, SIGNAL(canceled()));
addAction(d->cancelAction);
}
diff --git a/src/gui/dialogs/qwizard.cpp b/src/gui/dialogs/qwizard.cpp
index 64588d2..0f6d353 100644
--- a/src/gui/dialogs/qwizard.cpp
+++ b/src/gui/dialogs/qwizard.cpp
@@ -1343,32 +1343,19 @@ bool QWizardPrivate::ensureButton(QWizard::WizardButton which) const
QAction *softKey = new QAction(pushButton->text(), antiFlickerWidget);
QAction::SoftKeyRole softKeyRole;
switch(which) {
- case QWizard::BackButton:
- softKeyRole = QAction::PreviousSoftKey;
- break;
case QWizard::NextButton:
- softKeyRole = QAction::NextSoftKey;
- break;
- case QWizard::CommitButton:
- softKeyRole = QAction::EndEditSoftKey;
- break;
case QWizard::FinishButton:
- softKeyRole = QAction::FinishSoftKey;
- break;
case QWizard::CancelButton:
- softKeyRole = QAction::CancelSoftKey;
+ softKeyRole = QAction::NegativeSoftKey;
break;
+ case QWizard::BackButton:
+ case QWizard::CommitButton:
case QWizard::HelpButton:
- softKeyRole = QAction::ViewSoftKey;
- break;
case QWizard::CustomButton1:
- softKeyRole = QAction::SelectSoftKey;
- break;
case QWizard::CustomButton2:
- softKeyRole = QAction::SelectSoftKey;
- break;
case QWizard::CustomButton3:
- softKeyRole = QAction::SelectSoftKey;
+ default:
+ softKeyRole = QAction::PositiveSoftKey;
break;
}
softKey->setSoftKeyRole(softKeyRole);