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.cpp63
-rw-r--r--tests/manual/dialogs/filedialogpanel.h38
-rw-r--r--tests/manual/dialogs/fontdialogpanel.cpp46
-rw-r--r--tests/manual/dialogs/fontdialogpanel.h31
-rw-r--r--tests/manual/dialogs/main.cpp29
-rw-r--r--tests/manual/dialogs/messageboxpanel.cpp29
-rw-r--r--tests/manual/dialogs/messageboxpanel.h29
-rw-r--r--tests/manual/dialogs/printdialogpanel.cpp31
-rw-r--r--tests/manual/dialogs/printdialogpanel.h29
-rw-r--r--tests/manual/dialogs/utils.cpp68
-rw-r--r--tests/manual/dialogs/utils.h45
-rw-r--r--tests/manual/dialogs/wizardpanel.cpp53
-rw-r--r--tests/manual/dialogs/wizardpanel.h32
16 files changed, 160 insertions, 457 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 f72ab3d107..2f47c5ad0a 100644
--- a/tests/manual/dialogs/filedialogpanel.cpp
+++ b/tests/manual/dialogs/filedialogpanel.cpp
@@ -1,30 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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();
}
@@ -445,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())
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 629fa95262..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();
}
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 90915b18ea..d8b3f3c567 100644
--- a/tests/manual/dialogs/main.cpp
+++ b/tests/manual/dialogs/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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"
diff --git a/tests/manual/dialogs/messageboxpanel.cpp b/tests/manual/dialogs/messageboxpanel.cpp
index 25c230a855..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"
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 0f34d01033..a8d54e8aa2 100644
--- a/tests/manual/dialogs/printdialogpanel.h
+++ b/tests/manual/dialogs/printdialogpanel.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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
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..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"
@@ -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;
@@ -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();