diff options
Diffstat (limited to 'tests/manual/dialogs/colordialogpanel.cpp')
-rw-r--r-- | tests/manual/dialogs/colordialogpanel.cpp | 48 |
1 files changed, 9 insertions, 39 deletions
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(); } |