summaryrefslogtreecommitdiffstats
path: root/tests/manual/dialogs/wizardpanel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/dialogs/wizardpanel.cpp')
-rw-r--r--tests/manual/dialogs/wizardpanel.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/tests/manual/dialogs/wizardpanel.cpp b/tests/manual/dialogs/wizardpanel.cpp
index f5f8f1b77a..6fa7d1803a 100644
--- a/tests/manual/dialogs/wizardpanel.cpp
+++ b/tests/manual/dialogs/wizardpanel.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "wizardpanel.h"
@@ -191,7 +191,7 @@ class WizardPage : public QWizardPage
public:
explicit WizardPage(const QString &title, QWidget *parent = nullptr);
- void initializePage();
+ void initializePage() override;
private:
WizardStyleControl *m_styleControl;
@@ -271,8 +271,14 @@ WizardPanel::WizardPanel(QWidget *parent)
gridLayout->addWidget(m_styleControl, 0, 1);
QGroupBox *buttonGroupBox = new QGroupBox(this);
QVBoxLayout *vLayout = new QVBoxLayout(buttonGroupBox);
- QPushButton *button = new QPushButton(tr("Show modal"), this);
- connect(button, SIGNAL(clicked()), this, SLOT(showModal()));
+ QPushButton *button = new QPushButton(tr("Exec modal"), this);
+ connect(button, SIGNAL(clicked()), this, SLOT(execModal()));
+ vLayout->addWidget(button);
+ button = new QPushButton(tr("Show application modal"), this);
+ connect(button, &QPushButton::clicked, [this]() { showModal(Qt::ApplicationModal); });
+ vLayout->addWidget(button);
+ button = new QPushButton(tr("Show window modal"), this);
+ connect(button, &QPushButton::clicked, [this]() { showModal(Qt::WindowModal); });
vLayout->addWidget(button);
button = new QPushButton(tr("Show non-modal"), this);
connect(button, SIGNAL(clicked()), this, SLOT(showNonModal()));
@@ -285,13 +291,23 @@ WizardPanel::WizardPanel(QWidget *parent)
gridLayout->addWidget(buttonGroupBox, 1, 1);
}
-void WizardPanel::showModal()
+void WizardPanel::execModal()
{
Wizard wizard(this);
applyParameters(&wizard);
wizard.exec();
}
+void WizardPanel::showModal(Qt::WindowModality modality)
+{
+ Wizard *wizard = new Wizard(this);
+ applyParameters(wizard);
+ wizard->setModal(true);
+ wizard->setAttribute(Qt::WA_DeleteOnClose);
+ wizard->setWindowModality(modality);
+ wizard->show();
+}
+
void WizardPanel::showNonModal()
{
Wizard *wizard = new Wizard(this);