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.cpp63
1 files changed, 27 insertions, 36 deletions
diff --git a/tests/manual/dialogs/wizardpanel.cpp b/tests/manual/dialogs/wizardpanel.cpp
index 8e8af5f556..6fa7d1803a 100644
--- a/tests/manual/dialogs/wizardpanel.cpp
+++ b/tests/manual/dialogs/wizardpanel.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "wizardpanel.h"
@@ -73,7 +48,7 @@ class WizardStyleControl : public QGroupBox
{
Q_OBJECT
public:
- WizardStyleControl(QWidget *parent = 0);
+ WizardStyleControl(QWidget *parent = nullptr);
void setWizardStyle(int style);
QWizard::WizardStyle wizardStyle() const;
@@ -90,7 +65,7 @@ WizardStyleControl::WizardStyleControl(QWidget *parent)
, m_group(new QButtonGroup(this))
{
m_group->setExclusive(true);
- connect(m_group, SIGNAL(buttonClicked(int)), this, SIGNAL(wizardStyleChanged(int)));
+ connect(m_group, &QButtonGroup::idClicked, this, &WizardStyleControl::wizardStyleChanged);
QVBoxLayout *vLayout = new QVBoxLayout(this);
QRadioButton *radioButton = new QRadioButton(tr("None/OS Default"), this);
m_group->addButton(radioButton, QWizard::NStyles);
@@ -132,7 +107,7 @@ void WizardStyleControl::setWizardStyle(int wizardStyle)
class WizardOptionsControl : public QGroupBox
{
public:
- explicit WizardOptionsControl(QWidget *parent = 0);
+ explicit WizardOptionsControl(QWidget *parent = nullptr);
QWizard::WizardOption wizardOptions() const;
void setWizardOptions(int options);
@@ -214,9 +189,9 @@ void Wizard::changeWizardStyle(int newStyle)
class WizardPage : public QWizardPage
{
public:
- explicit WizardPage(const QString &title, QWidget *parent = 0);
+ explicit WizardPage(const QString &title, QWidget *parent = nullptr);
- void initializePage();
+ void initializePage() override;
private:
WizardStyleControl *m_styleControl;
@@ -257,7 +232,7 @@ Wizard::Wizard(QWidget *parent, Qt::WindowFlags flags)
// A dialog using a Wizard as child widget (emulating Qt Designer).
class WizardEmbeddingDialog : public QDialog {
public:
- explicit WizardEmbeddingDialog(QWidget *parent = 0);
+ explicit WizardEmbeddingDialog(QWidget *parent = nullptr);
Wizard *wizard() const { return m_wizard; }
@@ -296,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()));
@@ -310,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);