summaryrefslogtreecommitdiffstats
path: root/tests/manual/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/dialogs')
-rw-r--r--tests/manual/dialogs/CMakeLists.txt15
-rw-r--r--tests/manual/dialogs/colordialogpanel.cpp48
-rw-r--r--tests/manual/dialogs/colordialogpanel.h31
-rw-r--r--tests/manual/dialogs/filedialogpanel.cpp77
-rw-r--r--tests/manual/dialogs/filedialogpanel.h38
-rw-r--r--tests/manual/dialogs/fontdialogpanel.cpp48
-rw-r--r--tests/manual/dialogs/fontdialogpanel.h31
-rw-r--r--tests/manual/dialogs/main.cpp37
-rw-r--r--tests/manual/dialogs/messageboxpanel.cpp33
-rw-r--r--tests/manual/dialogs/messageboxpanel.h29
-rw-r--r--tests/manual/dialogs/printdialogpanel.cpp31
-rw-r--r--tests/manual/dialogs/printdialogpanel.h61
-rw-r--r--tests/manual/dialogs/utils.cpp68
-rw-r--r--tests/manual/dialogs/utils.h45
-rw-r--r--tests/manual/dialogs/wizardpanel.cpp55
-rw-r--r--tests/manual/dialogs/wizardpanel.h32
16 files changed, 161 insertions, 518 deletions
diff --git a/tests/manual/dialogs/CMakeLists.txt b/tests/manual/dialogs/CMakeLists.txt
index 09c9a287c2..1900b68540 100644
--- a/tests/manual/dialogs/CMakeLists.txt
+++ b/tests/manual/dialogs/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from dialogs.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## dialogs Binary:
@@ -14,25 +15,27 @@ qt_internal_add_manual_test(dialogs
messageboxpanel.cpp messageboxpanel.h
utils.cpp utils.h
wizardpanel.cpp wizardpanel.h
- PUBLIC_LIBRARIES
+ NO_PCH_SOURCES
+ filedialogpanel.cpp # undef QT_NO_FOREACH
+ utils.cpp # undef QT_NO_FOREACH
+ LIBRARIES
Qt::Gui
Qt::Widgets
)
-#### Keys ignored in scope 1:.:.:dialogs.pro:<TRUE>:
-# TEMPLATE = "app"
-
## Scopes:
#####################################################################
qt_internal_extend_target(dialogs CONDITION TARGET Qt::PrintSupport
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::PrintSupport
)
qt_internal_extend_target(dialogs CONDITION NOT (QT_FEATURE_printer EQUAL FALSE)
SOURCES
printdialogpanel.cpp printdialogpanel.h printdialogpanel.ui
+ NO_PCH_SOURCES
+ printdialogpanel.cpp # undef QT_NO_FOREACH
ENABLE_AUTOGEN_TOOLS
uic
)
diff --git a/tests/manual/dialogs/colordialogpanel.cpp b/tests/manual/dialogs/colordialogpanel.cpp
index f47e4ea8f1..c9052263b6 100644
--- a/tests/manual/dialogs/colordialogpanel.cpp
+++ b/tests/manual/dialogs/colordialogpanel.cpp
@@ -1,32 +1,8 @@
-/****************************************************************************
-**
-** 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 "colordialogpanel.h"
+#include "utils.h"
#include <QGroupBox>
#include <QCheckBox>
@@ -69,15 +45,6 @@ static inline QStringList svgColorNames()
<< "turquoise" << "violet" << "wheat" << "white" << "whitesmoke" << "yellow" << "yellowgreen";
}
-static inline QPushButton *addButton(const QString &description, QVBoxLayout *layout,
- QObject *receiver, const char *slotFunc)
-{
- QPushButton *button = new QPushButton(description);
- QObject::connect(button, SIGNAL(clicked()), receiver, slotFunc);
- layout->addWidget(button);
- return button;
-}
-
class ColorProxyModel : public QSortFilterProxyModel
{
public:
@@ -85,7 +52,7 @@ public:
{
}
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override
{
if (role == Qt::DisplayRole) {
QString name = data(index, Qt::EditRole).toString();
@@ -128,7 +95,9 @@ ColorDialogPanel::ColorDialogPanel(QWidget *parent)
QGroupBox *buttonsGroupBox = new QGroupBox(tr("Show"));
QVBoxLayout *buttonsLayout = new QVBoxLayout(buttonsGroupBox);
addButton(tr("Exec modal"), buttonsLayout, this, SLOT(execModal()));
- addButton(tr("Show modal"), buttonsLayout, this, SLOT(showModal()));
+ addButton(tr("Show application modal"), buttonsLayout,
+ [this]() { showModal(Qt::ApplicationModal); });
+ addButton(tr("Show window modal"), buttonsLayout, [this]() { showModal(Qt::WindowModal); });
m_deleteModalDialogButton =
addButton(tr("Delete modal"), buttonsLayout, this, SLOT(deleteModalDialog()));
addButton(tr("Show non-modal"), buttonsLayout, this, SLOT(showNonModal()));
@@ -162,7 +131,7 @@ void ColorDialogPanel::execModal()
dialog.exec();
}
-void ColorDialogPanel::showModal()
+void ColorDialogPanel::showModal(Qt::WindowModality modality)
{
if (m_modalDialog.isNull()) {
static int n = 0;
@@ -176,6 +145,7 @@ void ColorDialogPanel::showModal()
.arg(QLatin1String(QT_VERSION_STR)));
enableDeleteModalDialogButton();
}
+ m_modalDialog->setWindowModality(modality);
applySettings(m_modalDialog);
m_modalDialog->show();
}
diff --git a/tests/manual/dialogs/colordialogpanel.h b/tests/manual/dialogs/colordialogpanel.h
index a299337f43..06eff59945 100644
--- a/tests/manual/dialogs/colordialogpanel.h
+++ b/tests/manual/dialogs/colordialogpanel.h
@@ -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
#ifndef COLORDIALOGPANEL_H
#define COLORDIALOGPANEL_H
@@ -46,7 +21,7 @@ public:
public slots:
void execModal();
- void showModal();
+ void showModal(Qt::WindowModality modality);
void showNonModal();
void deleteNonModalDialog();
void deleteModalDialog();
diff --git a/tests/manual/dialogs/filedialogpanel.cpp b/tests/manual/dialogs/filedialogpanel.cpp
index 9f2ae559d7..2f47c5ad0a 100644
--- a/tests/manual/dialogs/filedialogpanel.cpp
+++ b/tests/manual/dialogs/filedialogpanel.cpp
@@ -1,30 +1,7 @@
-/****************************************************************************
-**
-** 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) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include "filedialogpanel.h"
#include "utils.h"
@@ -68,15 +45,6 @@ const FlagData fileModeComboData[] =
{"Directory", QFileDialog::Directory}
};
-static inline QPushButton *addButton(const QString &description, QGridLayout *layout,
- int &row, int column, QObject *receiver, const char *slotFunc)
-{
- QPushButton *button = new QPushButton(description);
- QObject::connect(button, SIGNAL(clicked()), receiver, slotFunc);
- layout->addWidget(button, row++, column);
- return button;
-}
-
// A line edit for editing the label fields of the dialog, keeping track of whether it has
// been modified by the user to avoid applying Qt's default texts to native dialogs.
@@ -118,6 +86,7 @@ FileDialogPanel::FileDialogPanel(QWidget *parent)
, m_resolveSymLinks(new QCheckBox(tr("Resolve symlinks")))
, m_native(new QCheckBox(tr("Use native dialog")))
, m_customDirIcons(new QCheckBox(tr("Don't use custom directory icons")))
+ , m_noIconProvider(new QCheckBox(tr("Null icon provider")))
, m_acceptMode(createCombo(this, acceptModeComboData, sizeof(acceptModeComboData)/sizeof(FlagData)))
, m_fileMode(createCombo(this, fileModeComboData, sizeof(fileModeComboData)/sizeof(FlagData)))
, m_viewMode(createCombo(this, viewModeComboData, sizeof(viewModeComboData)/sizeof(FlagData)))
@@ -145,6 +114,7 @@ FileDialogPanel::FileDialogPanel(QWidget *parent)
optionsLayout->addRow(m_resolveSymLinks);
optionsLayout->addRow(m_readOnly);
optionsLayout->addRow(m_customDirIcons);
+ optionsLayout->addRow(m_noIconProvider);
// Files
QGroupBox *filesGroupBox = new QGroupBox(tr("Files / Filters"));
@@ -177,9 +147,12 @@ FileDialogPanel::FileDialogPanel(QWidget *parent)
int row = 0;
int column = 0;
addButton(tr("Exec modal"), buttonLayout, row, column, this, SLOT(execModal()));
- addButton(tr("Show modal"), buttonLayout, row, column, this, SLOT(showModal()));
- m_deleteModalDialogButton =
- addButton(tr("Delete modal"), buttonLayout, row, column, this, SLOT(deleteModalDialog()));
+ addButton(tr("Show application modal"), buttonLayout, row, column,
+ [this]() { showModal(Qt::ApplicationModal); });
+ addButton(tr("Show window modal"), buttonLayout, row, column,
+ [this]() { showModal(Qt::WindowModal); });
+ m_deleteModalDialogButton = addButton(tr("Delete modal"), buttonLayout, row, column, this,
+ SLOT(deleteModalDialog()));
addButton(tr("Show non-modal"), buttonLayout, row, column, this, SLOT(showNonModal()));
m_deleteNonModalDialogButton =
addButton(tr("Delete non-modal"), buttonLayout, row, column, this, SLOT(deleteNonModalDialog()));
@@ -218,7 +191,7 @@ void FileDialogPanel::execModal()
dialog.exec();
}
-void FileDialogPanel::showModal()
+void FileDialogPanel::showModal(Qt::WindowModality modality)
{
if (m_modalDialog.isNull()) {
static int n = 0;
@@ -230,6 +203,7 @@ void FileDialogPanel::showModal()
.arg(QLatin1String(QT_VERSION_STR)));
enableDeleteModalDialogButton();
}
+ m_modalDialog->setWindowModality(modality);
applySettings(m_modalDialog);
m_modalDialog->show();
}
@@ -326,7 +300,6 @@ void FileDialogPanel::getOpenFileNames()
void FileDialogPanel::getOpenFileUrls()
{
-#if QT_VERSION >= 0x050000
QString selectedFilter = m_selectedNameFilter->text().trimmed();
const QList<QUrl> files =
QFileDialog::getOpenFileUrls(this, tr("getOpenFileNames Qt %1").arg(QLatin1String(QT_VERSION_STR)),
@@ -339,7 +312,6 @@ void FileDialogPanel::getOpenFileUrls()
<< "\nName filter: " << selectedFilter;
QMessageBox::information(this, tr("getOpenFileNames"), result, QMessageBox::Ok);
}
-#endif // Qt 5
}
void FileDialogPanel::getOpenFileName()
@@ -359,7 +331,6 @@ void FileDialogPanel::getOpenFileName()
void FileDialogPanel::getOpenFileUrl()
{
-#if QT_VERSION >= 0x050000
QString selectedFilter = m_selectedNameFilter->text().trimmed();
const QUrl file =
QFileDialog::getOpenFileUrl(this, tr("getOpenFileUrl Qt %1").arg(QLatin1String(QT_VERSION_STR)),
@@ -372,7 +343,6 @@ void FileDialogPanel::getOpenFileUrl()
<< "\nName filter: " << selectedFilter;
QMessageBox::information(this, tr("getOpenFileName"), result, QMessageBox::Ok);
}
-#endif // Qt 5
}
void FileDialogPanel::getSaveFileName()
@@ -392,7 +362,6 @@ void FileDialogPanel::getSaveFileName()
void FileDialogPanel::getSaveFileUrl()
{
-#if QT_VERSION >= 0x050000
QString selectedFilter = m_selectedNameFilter->text().trimmed();
const QUrl file =
QFileDialog::getSaveFileUrl(this, tr("getSaveFileName Qt %1").arg(QLatin1String(QT_VERSION_STR)),
@@ -405,7 +374,6 @@ void FileDialogPanel::getSaveFileUrl()
<< "\nName filter: " << selectedFilter;
QMessageBox::information(this, tr("getSaveFileNames"), result, QMessageBox::Ok);
}
-#endif // Qt 5
}
void FileDialogPanel::getExistingDirectory()
@@ -419,14 +387,12 @@ void FileDialogPanel::getExistingDirectory()
void FileDialogPanel::getExistingDirectoryUrl()
{
-#if QT_VERSION >= 0x050000
const QUrl dir =
QFileDialog::getExistingDirectoryUrl(this, tr("getExistingDirectory Qt %1").arg(QLatin1String(QT_VERSION_STR)),
currentDirectoryUrl(), options() | QFileDialog::ShowDirsOnly,
allowedSchemes());
if (!dir.isEmpty())
QMessageBox::information(this, tr("getExistingDirectory"), QLatin1String("Directory: ") + dir.toString(), QMessageBox::Ok);
-#endif // Qt 5
}
void FileDialogPanel::restoreDefaults()
@@ -453,12 +419,19 @@ void FileDialogPanel::restoreDefaults()
l->restoreDefault(&d);
}
-void FileDialogPanel::applySettings(QFileDialog *d) const
+void FileDialogPanel::applySettings(QFileDialog *d)
{
d->setAcceptMode(comboBoxValue<QFileDialog::AcceptMode>(m_acceptMode));
d->setViewMode(comboBoxValue<QFileDialog::ViewMode>(m_viewMode));
d->setFileMode(comboBoxValue<QFileDialog::FileMode>(m_fileMode));
d->setOptions(options());
+ if (m_noIconProvider->isChecked()) {
+ m_origIconProvider = d->iconProvider();
+ d->setIconProvider(nullptr);
+ } else if (m_origIconProvider) {
+ d->setIconProvider(m_origIconProvider);
+ }
+
d->setDefaultSuffix(m_defaultSuffix->text().trimmed());
const QString directory = m_directory->text().trimmed();
if (!directory.isEmpty())
@@ -473,11 +446,9 @@ void FileDialogPanel::applySettings(QFileDialog *d) const
if (!filter.isEmpty())
d->selectNameFilter(filter);
} else {
-#if QT_VERSION >= 0x050000
d->setMimeTypeFilters(filters);
if (!filter.isEmpty())
d->selectMimeTypeFilter(filter);
-#endif // Qt 5
}
foreach (LabelLineEdit *l, m_labelLineEdits)
l->apply(d);
@@ -504,14 +475,10 @@ void FileDialogPanel::accepted()
Q_ASSERT(d);
m_result.clear();
QDebug(&m_result).nospace()
-#if QT_VERSION >= 0x050000
<< "URLs: " << d->selectedUrls() << '\n'
-#endif
<< "Files: " << d->selectedFiles()
<< "\nDirectory: "
-#if QT_VERSION >= 0x050000
<< d->directoryUrl() << ", "
-#endif
<< d->directory().absolutePath()
<< "\nName filter: " << d->selectedNameFilter();
QTimer::singleShot(0, this, SLOT(showAcceptedResult())); // Avoid problems with the closing (modal) dialog as parent.
diff --git a/tests/manual/dialogs/filedialogpanel.h b/tests/manual/dialogs/filedialogpanel.h
index 28dded3891..3acf193121 100644
--- a/tests/manual/dialogs/filedialogpanel.h
+++ b/tests/manual/dialogs/filedialogpanel.h
@@ -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
#ifndef FILEDIALOGPANEL_H
#define FILEDIALOGPANEL_H
@@ -34,6 +9,8 @@
#include <QPointer>
QT_BEGIN_NAMESPACE
+
+class QAbstractFileIconProvider;
class QPushButton;
class QCheckBox;
class QComboBox;
@@ -51,7 +28,7 @@ public:
public slots:
void execModal();
- void showModal();
+ void showModal(Qt::WindowModality modality);
void showNonModal();
void deleteNonModalDialog();
void deleteModalDialog();
@@ -77,7 +54,7 @@ private:
QString filterString() const;
QFileDialog::Options options() const;
QStringList allowedSchemes() const;
- void applySettings(QFileDialog *d) const;
+ void applySettings(QFileDialog *d);
QFormLayout *filesLayout;
QCheckBox *m_showDirsOnly;
@@ -87,6 +64,9 @@ private:
QCheckBox *m_resolveSymLinks;
QCheckBox *m_native;
QCheckBox *m_customDirIcons;
+ QCheckBox *m_noIconProvider = nullptr;
+ QAbstractFileIconProvider *m_origIconProvider = nullptr;
+
QComboBox *m_acceptMode;
QComboBox *m_fileMode;
QComboBox *m_viewMode;
diff --git a/tests/manual/dialogs/fontdialogpanel.cpp b/tests/manual/dialogs/fontdialogpanel.cpp
index 8ed52a8a75..4d599c456d 100644
--- a/tests/manual/dialogs/fontdialogpanel.cpp
+++ b/tests/manual/dialogs/fontdialogpanel.cpp
@@ -1,32 +1,8 @@
-/****************************************************************************
-**
-** 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 "fontdialogpanel.h"
+#include "utils.h"
#include <QGroupBox>
#include <QCheckBox>
@@ -39,15 +15,6 @@
#include <QTimer>
#include <QDebug>
-static inline QPushButton *addButton(const QString &description, QVBoxLayout *layout,
- QObject *receiver, const char *slotFunc)
-{
- QPushButton *button = new QPushButton(description);
- QObject::connect(button, SIGNAL(clicked()), receiver, slotFunc);
- layout->addWidget(button);
- return button;
-}
-
FontDialogPanel::FontDialogPanel(QWidget *parent)
: QWidget(parent)
, m_fontFamilyBox(new QFontComboBox)
@@ -80,7 +47,9 @@ FontDialogPanel::FontDialogPanel(QWidget *parent)
QGroupBox *buttonsGroupBox = new QGroupBox(tr("Show"));
QVBoxLayout *buttonsLayout = new QVBoxLayout(buttonsGroupBox);
addButton(tr("Exec modal"), buttonsLayout, this, SLOT(execModal()));
- addButton(tr("Show modal"), buttonsLayout, this, SLOT(showModal()));
+ addButton(tr("Show application modal"), buttonsLayout,
+ [this]() { showModal(Qt::ApplicationModal); });
+ addButton(tr("Show window modal"), buttonsLayout, [this]() { showModal(Qt::WindowModal); });
m_deleteModalDialogButton =
addButton(tr("Delete modal"), buttonsLayout, this, SLOT(deleteModalDialog()));
addButton(tr("Show non-modal"), buttonsLayout, this, SLOT(showNonModal()));
@@ -112,7 +81,7 @@ void FontDialogPanel::execModal()
dialog.exec();
}
-void FontDialogPanel::showModal()
+void FontDialogPanel::showModal(Qt::WindowModality modality)
{
if (m_modalDialog.isNull()) {
static int n = 0;
@@ -124,6 +93,7 @@ void FontDialogPanel::showModal()
.arg(QLatin1String(QT_VERSION_STR)));
enableDeleteModalDialogButton();
}
+ m_modalDialog->setWindowModality(modality);
applySettings(m_modalDialog);
m_modalDialog->show();
}
@@ -196,12 +166,10 @@ void FontDialogPanel::applySettings(QFontDialog *d) const
{
d->setOption(QFontDialog::NoButtons, m_noButtons->isChecked());
d->setOption(QFontDialog::DontUseNativeDialog, m_dontUseNativeDialog->isChecked());
-#if QT_VERSION >= 0x050000
d->setOption(QFontDialog::ScalableFonts, m_scalableFilter->isChecked());
d->setOption(QFontDialog::NonScalableFonts, m_nonScalableFilter->isChecked());
d->setOption(QFontDialog::MonospacedFonts, m_monospacedFilter->isChecked());
d->setOption(QFontDialog::ProportionalFonts, m_proportionalFilter->isChecked());
-#endif // Qt 5
QFont font = m_fontFamilyBox->currentFont();
font.setPointSizeF(m_fontSizeBox->value());
diff --git a/tests/manual/dialogs/fontdialogpanel.h b/tests/manual/dialogs/fontdialogpanel.h
index 2bcd68c74c..db3f2fc3f4 100644
--- a/tests/manual/dialogs/fontdialogpanel.h
+++ b/tests/manual/dialogs/fontdialogpanel.h
@@ -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
#ifndef FONTDIALOGPANEL_H
#define FONTDIALOGPANEL_H
@@ -47,7 +22,7 @@ public:
public slots:
void execModal();
- void showModal();
+ void showModal(Qt::WindowModality modality);
void showNonModal();
void deleteNonModalDialog();
void deleteModalDialog();
diff --git a/tests/manual/dialogs/main.cpp b/tests/manual/dialogs/main.cpp
index da9daab942..d8b3f3c567 100644
--- a/tests/manual/dialogs/main.cpp
+++ b/tests/manual/dialogs/main.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) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "filedialogpanel.h"
#include "colordialogpanel.h"
@@ -59,15 +34,9 @@ AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent)
{
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QFormLayout *mainLayout = new QFormLayout(this);
-#if QT_VERSION >= 0x050600
mainLayout->addRow(new QLabel(QLibraryInfo::build()));
-#else
- mainLayout->addRow(new QLabel(QLatin1String("Qt ") + QLatin1String(QT_VERSION_STR )));
-#endif
mainLayout->addRow("Style:", new QLabel(qApp->style()->objectName()));
-#if QT_VERSION >= 0x050600
mainLayout->addRow("DPR:", new QLabel(QString::number(qApp->devicePixelRatio())));
-#endif
const QString resolution = QString::number(logicalDpiX()) + QLatin1Char(',')
+ QString::number(logicalDpiY()) + QLatin1String("dpi");
mainLayout->addRow("Resolution:", new QLabel(resolution));
@@ -129,9 +98,7 @@ int main(int argc, char *argv[])
for (int a = 1; a < argc; ++a) {
if (!qstrcmp(argv[a], "-n")) {
qDebug("AA_DontUseNativeDialogs");
-#if QT_VERSION >= 0x050700
QCoreApplication::setAttribute(Qt::AA_DontUseNativeDialogs);
-#endif
} else if (!qstrcmp(argv[a], "-p")) {
optNoPrinter = true; // Avoid startup slowdown by printer code
}
diff --git a/tests/manual/dialogs/messageboxpanel.cpp b/tests/manual/dialogs/messageboxpanel.cpp
index 6a305523ea..1d03072123 100644
--- a/tests/manual/dialogs/messageboxpanel.cpp
+++ b/tests/manual/dialogs/messageboxpanel.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Thorbjørn Lund Martsum - tmartsum[at]gmail.com
-** 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) 2013 Thorbjørn Lund Martsum - tmartsum[at]gmail.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "messageboxpanel.h"
@@ -138,11 +113,9 @@ void MessageBoxPanel::setupMessageBox(QMessageBox &box)
if (box.standardButtons() == QMessageBox::StandardButtons())
box.setStandardButtons(QMessageBox::Ok); // just to have something.
-#if QT_VERSION >= 0x050000
box.setCheckBox(0);
if (m_checkboxText->text().length() > 0)
box.setCheckBox(new QCheckBox(m_checkboxText->text()));
-#endif // Qt 5
box.setIcon((QMessageBox::Icon) m_iconComboBox->currentIndex());
}
@@ -167,14 +140,12 @@ void MessageBoxPanel::doExec()
QString sres;
sres.setNum(res, 16);
m_resultLabel->setText(QString::fromLatin1("Return value (hex): %1").arg(sres));
-#if QT_VERSION >= 0x050000
if (m_msgbox->checkBox()) {
if (m_msgbox->checkBox()->isChecked())
m_checkBoxResult->setText(QString::fromLatin1("Checkbox was checked"));
else
m_checkBoxResult->setText(QString::fromLatin1("Checkbox was not checked"));
}
-#endif // Qt 5
}
void MessageBoxPanel::doShowApply()
diff --git a/tests/manual/dialogs/messageboxpanel.h b/tests/manual/dialogs/messageboxpanel.h
index d5ca6057d1..c84657562b 100644
--- a/tests/manual/dialogs/messageboxpanel.h
+++ b/tests/manual/dialogs/messageboxpanel.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 2013 Thorbjørn Lund Martsum - tmartsum[at]gmail.com
-** 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) 2013 2013 Thorbjørn Lund Martsum - tmartsum[at]gmail.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef MESSAGEBOXPANEL_H
#define MESSAGEBOXPANEL_H
diff --git a/tests/manual/dialogs/printdialogpanel.cpp b/tests/manual/dialogs/printdialogpanel.cpp
index d36715e9dd..716faa48c6 100644
--- a/tests/manual/dialogs/printdialogpanel.cpp
+++ b/tests/manual/dialogs/printdialogpanel.cpp
@@ -1,30 +1,7 @@
-/****************************************************************************
-**
-** 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
+
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#ifndef QT_NO_PRINTER
diff --git a/tests/manual/dialogs/printdialogpanel.h b/tests/manual/dialogs/printdialogpanel.h
index 618e34d596..a8d54e8aa2 100644
--- a/tests/manual/dialogs/printdialogpanel.h
+++ b/tests/manual/dialogs/printdialogpanel.h
@@ -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) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef PRINTDIALOGPANEL_H
#define PRINTDIALOGPANEL_H
@@ -33,9 +8,7 @@
#include "ui_printdialogpanel.h"
-#if QT_VERSION >= 0x050300
#include <QPageLayout>
-#endif
#include <QPrinter>
#include <QWidget>
@@ -50,31 +23,6 @@ QT_END_NAMESPACE
class PageSizeControl;
class OptionsControl;
-#if QT_VERSION < 0x050300
-// Copied from class QPageLayout introduced in Qt 5.3
-namespace QPageLayout
-{
- enum Unit {
- Millimeter,
- Point,
- Inch,
- Pica,
- Didot,
- Cicero
- };
-
- enum Orientation {
- Portrait,
- Landscape
- };
-
- enum Mode {
- StandardMode, // Paint Rect includes margins
- FullPageMode // Paint Rect excludes margins
- };
-}
-#endif
-
class PrintDialogPanel : public QWidget
{
Q_OBJECT
@@ -107,12 +55,7 @@ private:
bool m_blockSignals;
Ui::PrintDialogPanel m_panel;
-#if QT_VERSION >= 0x050300
QPageLayout m_pageLayout;
-#else
- QPrinter m_printerLayout;
- QPrinter::Unit m_units;
-#endif
QScopedPointer<QPrinter> m_printer;
};
diff --git a/tests/manual/dialogs/utils.cpp b/tests/manual/dialogs/utils.cpp
index e584f0d6ff..bfb61cd8df 100644
--- a/tests/manual/dialogs/utils.cpp
+++ b/tests/manual/dialogs/utils.cpp
@@ -1,34 +1,13 @@
-/****************************************************************************
-**
-** 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
+
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include "utils.h"
#include <QCheckBox>
+#include <QGridLayout>
+#include <QPushButton>
#include <QVBoxLayout>
QComboBox *createCombo(QWidget *parent, const FlagData *d, size_t size)
@@ -91,3 +70,38 @@ int OptionsControl::intValue() const
}
return result;
}
+
+QPushButton *addButton(const QString &description, QGridLayout *layout, int &row, int column,
+ QObject *receiver, const char *slotFunc)
+{
+ QPushButton *button = new QPushButton(description);
+ QObject::connect(button, SIGNAL(clicked()), receiver, slotFunc);
+ layout->addWidget(button, row++, column);
+ return button;
+}
+
+QPushButton *addButton(const QString &description, QGridLayout *layout, int &row, int column,
+ std::function<void()> fn)
+{
+ QPushButton *button = new QPushButton(description);
+ QObject::connect(button, &QPushButton::clicked, fn);
+ layout->addWidget(button, row++, column);
+ return button;
+}
+
+QPushButton *addButton(const QString &description, QVBoxLayout *layout, QObject *receiver,
+ const char *slotFunc)
+{
+ QPushButton *button = new QPushButton(description);
+ QObject::connect(button, SIGNAL(clicked()), receiver, slotFunc);
+ layout->addWidget(button);
+ return button;
+}
+
+QPushButton *addButton(const QString &description, QVBoxLayout *layout, std::function<void()> fn)
+{
+ QPushButton *button = new QPushButton(description);
+ QObject::connect(button, &QPushButton::clicked, fn);
+ layout->addWidget(button);
+ return button;
+}
diff --git a/tests/manual/dialogs/utils.h b/tests/manual/dialogs/utils.h
index cac0f1af18..3db08ce44e 100644
--- a/tests/manual/dialogs/utils.h
+++ b/tests/manual/dialogs/utils.h
@@ -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
#ifndef UTILS_H
#define UTILS_H
@@ -35,7 +10,12 @@
#include <QPair>
#include <QList>
+#include <functional>
+
QT_FORWARD_DECLARE_CLASS(QCheckBox)
+QT_FORWARD_DECLARE_CLASS(QGridLayout)
+QT_FORWARD_DECLARE_CLASS(QVBoxLayout)
+QT_FORWARD_DECLARE_CLASS(QPushButton)
// Associate enum/flag value with a description.
struct FlagData
@@ -76,4 +56,15 @@ private:
QList<CheckBoxFlagPair> m_checkBoxes;
};
+QPushButton *addButton(const QString &description, QGridLayout *layout, int &row, int column,
+ QObject *receiver, const char *slotFunc);
+
+QPushButton *addButton(const QString &description, QGridLayout *layout, int &row, int column,
+ std::function<void()> fn);
+
+QPushButton *addButton(const QString &description, QVBoxLayout *layout, QObject *receiver,
+ const char *slotFunc);
+
+QPushButton *addButton(const QString &description, QVBoxLayout *layout, std::function<void()> fn);
+
#endif // UTILS_H
diff --git a/tests/manual/dialogs/wizardpanel.cpp b/tests/manual/dialogs/wizardpanel.cpp
index 4edb10afb8..5e413960e3 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"
@@ -216,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;
@@ -254,7 +229,7 @@ Wizard::Wizard(QWidget *parent, Qt::WindowFlags flags)
addPage(new WizardPage(tr("Page 3"), this));
}
-// A dialog using a Wizard as child widget (emulating Qt Designer).
+// A dialog using a Wizard as child widget (emulating Qt Widgets Designer).
class WizardEmbeddingDialog : public QDialog {
public:
explicit WizardEmbeddingDialog(QWidget *parent = nullptr);
@@ -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);
diff --git a/tests/manual/dialogs/wizardpanel.h b/tests/manual/dialogs/wizardpanel.h
index 8d9ee79274..42765aeaef 100644
--- a/tests/manual/dialogs/wizardpanel.h
+++ b/tests/manual/dialogs/wizardpanel.h
@@ -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
#ifndef WIZARDPANEL_H
#define WIZARDPANEL_H
@@ -44,7 +19,8 @@ public:
explicit WizardPanel(QWidget *parent = nullptr);
public slots:
- void showModal();
+ void execModal();
+ void showModal(Qt::WindowModality modality);
void showNonModal();
void showEmbedded();