diff options
author | Mikolaj Boc <[email protected]> | 2022-09-13 13:23:09 +0200 |
---|---|---|
committer | Mikolaj Boc <[email protected]> | 2022-09-13 18:13:00 +0200 |
commit | 701852e17b6440540bda4cbfb83743cf8fd2d4ba (patch) | |
tree | b0545059e9e4ca201fcf87b117679eed887bed27 /tests/manual/dialogs/wizardpanel.cpp | |
parent | 9ec7cbc77462938969e9569deeb5a106d321ce21 (diff) |
Add window-modal show option to dialogs manual test
This provides an easy way to test window modality using a ready
available test.
Change-Id: Ia23736c61fd56dda8f72ae19f5f102163951271b
Reviewed-by: Tor Arne Vestbø <[email protected]>
Diffstat (limited to 'tests/manual/dialogs/wizardpanel.cpp')
-rw-r--r-- | tests/manual/dialogs/wizardpanel.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/tests/manual/dialogs/wizardpanel.cpp b/tests/manual/dialogs/wizardpanel.cpp index f5f8f1b77aa..36605de9fa1 100644 --- a/tests/manual/dialogs/wizardpanel.cpp +++ b/tests/manual/dialogs/wizardpanel.cpp @@ -271,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())); @@ -285,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); |