diff options
Diffstat (limited to 'tests/manual/dialogs/fontdialogpanel.cpp')
-rw-r--r-- | tests/manual/dialogs/fontdialogpanel.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/tests/manual/dialogs/fontdialogpanel.cpp b/tests/manual/dialogs/fontdialogpanel.cpp index 63bef18513..4d599c456d 100644 --- a/tests/manual/dialogs/fontdialogpanel.cpp +++ b/tests/manual/dialogs/fontdialogpanel.cpp @@ -1,7 +1,8 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "fontdialogpanel.h" +#include "utils.h" #include <QGroupBox> #include <QCheckBox> @@ -14,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) @@ -55,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())); @@ -87,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; @@ -99,6 +93,7 @@ void FontDialogPanel::showModal() .arg(QLatin1String(QT_VERSION_STR))); enableDeleteModalDialogButton(); } + m_modalDialog->setWindowModality(modality); applySettings(m_modalDialog); m_modalDialog->show(); } |