summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs/qwizard.cpp
diff options
context:
space:
mode:
authorChristian Loose <christian.loose@hamburg.de>2013-09-23 20:40:52 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-09 21:03:25 +0100
commit955d0df8736577eea0061e61a924104e34d3915d (patch)
tree89eb91c6b449d2ac488015b58dcf66838d1b9a2a /src/widgets/dialogs/qwizard.cpp
parent0efc6e92d8008127c162e3c2721e6f4364aae8ab (diff)
Add option NoCancelButtonOnLastPage to QWizard
Add support to hide the cancel button on the last page of a wizard. This is useful for wizards where the last page is used as a summary page that should not be cancelled. [ChangeLog][QtWidgets][QWizard] Added NoCancelButtonOnLastPage option. Task-number: QTBUG-7484 Change-Id: I282bda55a8dec9cde6439a9285d79e0a5c6df96a Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/widgets/dialogs/qwizard.cpp')
-rw-r--r--src/widgets/dialogs/qwizard.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index 0ad1dad1b8..1cd294e5ea 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -1704,6 +1704,10 @@ void QWizardPrivate::_q_updateButtonStates()
btn.finish->setVisible(buttonLayoutContains(QWizard::FinishButton)
&& (canFinish || (opts & QWizard::HaveFinishButtonOnEarlyPages)));
+ if (!(opts & QWizard::NoCancelButton))
+ btn.cancel->setVisible(buttonLayoutContains(QWizard::CancelButton)
+ && (canContinue || !(opts & QWizard::NoCancelButtonOnLastPage)));
+
bool useDefault = !(opts & QWizard::NoDefaultButton);
if (QPushButton *nextPush = qobject_cast<QPushButton *>(btn.next))
nextPush->setDefault(canContinue && useDefault && !commitPage);
@@ -2188,6 +2192,7 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *)
\value HaveCustomButton1 Show the first user-defined button (CustomButton1).
\value HaveCustomButton2 Show the second user-defined button (CustomButton2).
\value HaveCustomButton3 Show the third user-defined button (CustomButton3).
+ \value NoCancelButtonOnLastPage Don't show the \uicontrol Cancel button on the last page.
\sa setOptions(), setOption(), testOption()
*/
@@ -2642,7 +2647,7 @@ void QWizard::setOptions(WizardOptions options)
d->updateButtonLayout();
} else if (changed & (NoBackButtonOnStartPage | NoBackButtonOnLastPage
| HaveNextButtonOnLastPage | HaveFinishButtonOnEarlyPages
- | DisabledBackButtonOnLastPage)) {
+ | DisabledBackButtonOnLastPage | NoCancelButtonOnLastPage)) {
d->_q_updateButtonStates();
}