diff options
author | Christian Loose <christian.loose@hamburg.de> | 2013-09-23 20:40:52 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-09 21:03:25 +0100 |
commit | 955d0df8736577eea0061e61a924104e34d3915d (patch) | |
tree | 89eb91c6b449d2ac488015b58dcf66838d1b9a2a /tests/auto | |
parent | 0efc6e92d8008127c162e3c2721e6f4364aae8ab (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 'tests/auto')
-rw-r--r-- | tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp index a711bc28e3..25a82050e3 100644 --- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp +++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp @@ -90,6 +90,7 @@ private slots: void setOption_HaveNextButtonOnLastPage(); void setOption_HaveFinishButtonOnEarlyPages(); void setOption_NoCancelButton(); + void setOption_NoCancelButtonOnLastPage(); void setOption_CancelButtonOnLeft(); void setOption_HaveHelpButton(); void setOption_HelpButtonOnRight(); @@ -1423,6 +1424,50 @@ void tst_QWizard::setOption_NoCancelButton() } } +void tst_QWizard::setOption_NoCancelButtonOnLastPage() +{ + for (int i = 0; i < 2; ++i) { + QWizard wizard; + wizard.setOption(QWizard::NoCancelButton, false); + wizard.setOption(QWizard::NoCancelButtonOnLastPage, true); + wizard.addPage(new QWizardPage); + wizard.addPage(new QWizardPage); + wizard.page(1)->setFinalPage(true); // changes nothing (final != last in general) + wizard.addPage(new QWizardPage); + + wizard.setStartId(1); + wizard.show(); + qApp->processEvents(); + + QVERIFY(wizard.button(QWizard::CancelButton)->isVisible()); + + wizard.next(); + qApp->processEvents(); + QVERIFY(!wizard.button(QWizard::CancelButton)->isVisible()); + + wizard.next(); + qApp->processEvents(); + QVERIFY(!wizard.button(QWizard::CancelButton)->isVisible()); + + wizard.back(); + qApp->processEvents(); + QVERIFY(wizard.button(QWizard::CancelButton)->isVisible()); + + wizard.next(); + qApp->processEvents(); + QVERIFY(!wizard.button(QWizard::CancelButton)->isVisible()); + + wizard.setOption(QWizard::NoCancelButtonOnLastPage, false); + QVERIFY(wizard.button(QWizard::CancelButton)->isVisible()); + + wizard.setOption(QWizard::NoCancelButtonOnLastPage, true); + QVERIFY(!wizard.button(QWizard::CancelButton)->isVisible()); + + wizard.addPage(new QWizardPage); + QVERIFY(!wizard.button(QWizard::CancelButton)->isVisible()); // this is maybe wrong + } +} + void tst_QWizard::setOption_CancelButtonOnLeft() { for (int i = 0; i < 2; ++i) { |