Remove modal child widget buttons from tests/manual/windowmodality

This functionality does not work anymore. Modality is tied to top-level
windows, not to any arbirtrary QWidget.

Change-Id: Ie7545cbcfbf4021850b215f014bb0f7274971327
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
Bradley T. Hughes 2012-03-29 12:13:33 +02:00 committed by Qt by Nokia
parent 5185a28139
commit 19109a7697
3 changed files with 54 additions and 144 deletions

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>565</width>
<height>361</height>
<width>574</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
@ -20,10 +20,10 @@
<string>Select the type of dialog to create:</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="5" column="0">
<item row="6" column="0">
<widget class="QPushButton" name="siblingApplicationModalButton">
<property name="text">
<string>Sibling Application Modal Dialog</string>
<string>Application Modal Dialog (sibling)</string>
</property>
</widget>
</item>
@ -34,28 +34,14 @@
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QPushButton" name="applicationModalChildButton">
<item row="5" column="1">
<widget class="QPushButton" name="applicationModalNoParentButton">
<property name="text">
<string>Application Modal Child Widget</string>
<string>Application Modal Dialog (no parent)</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="siblingWindowModalButton">
<property name="text">
<string>Sibling Window Modal Dialog</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="modelessNoParentButton">
<property name="text">
<string>Modeless Dialog (no parent)</string>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QPushButton" name="applicationModalButton">
<property name="text">
<string>Application Modal</string>
@ -69,46 +55,14 @@
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QPushButton" name="windowModalChildButton">
<item row="0" column="1">
<widget class="QPushButton" name="modelessNoParentButton">
<property name="text">
<string>Window Modal Child Widget</string>
<string>Modeless Dialog (no parent)</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="applicationModalNoParentButton">
<property name="text">
<string>Application Modal Dialog (no parent)</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QLabel" name="modalChildWidgetInfoLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string>Note: Modal Child Widgets are invisible and hidden after 5 seconds.</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="modelessButton">
<property name="text">
<string>Modeless Dialog</string>
</property>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QCheckBox" name="applicationModalUseExecCheckBox">
<property name="font">
<font>
@ -123,6 +77,20 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="modelessButton">
<property name="text">
<string>Modeless Dialog</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="siblingWindowModalButton">
<property name="text">
<string>Window Modal Dialog (sibling)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@ -67,16 +67,12 @@ private slots:
{ newDialog(Qt::WindowModal, this); }
void on_windowModalNoParentButton_clicked()
{ newDialog(Qt::WindowModal, 0); }
void on_windowModalChildButton_clicked()
{ newChildWidget(Qt::WindowModal); }
void on_siblingWindowModalButton_clicked()
{ newDialog(Qt::WindowModal, parentWidget()); }
void on_applicationModalButton_clicked()
{ newDialog(Qt::ApplicationModal, this); }
void on_applicationModalNoParentButton_clicked()
{ newDialog(Qt::ApplicationModal, 0); }
void on_applicationModalChildButton_clicked()
{ newChildWidget(Qt::ApplicationModal); }
void on_siblingApplicationModalButton_clicked()
{ newDialog(Qt::ApplicationModal, parentWidget()); }
@ -98,15 +94,6 @@ private:
else
dialog->show();
}
void newChildWidget(Qt::WindowModality windowModality)
{
QWidget *w = new QWidget(this);
w->setAttribute(Qt::WA_DeleteOnClose);
w->setWindowModality(windowModality);
w->setGeometry(0, 0, 0, 0);
w->show();
QTimer::singleShot(5000, w, SLOT(close()));
}
bool event(QEvent *event)
{
if (event->type() == QEvent::WindowBlocked)
@ -144,14 +131,10 @@ private slots:
{ newDialog(Qt::WindowModal); }
void on_windowModalNoParentButton_clicked()
{ newDialog(Qt::WindowModal, false); }
void on_windowModalChildButton_clicked()
{ newChildWidget(Qt::WindowModal); }
void on_applicationModalButton_clicked()
{ newDialog(Qt::ApplicationModal); }
void on_applicationModalNoParentButton_clicked()
{ newDialog(Qt::ApplicationModal, false); }
void on_applicationModalChildButton_clicked()
{ newChildWidget(Qt::ApplicationModal); }
private:
void newDialog(Qt::WindowModality windowModality, bool withParent = true)
@ -164,15 +147,6 @@ private:
else
dialog->show();
}
void newChildWidget(Qt::WindowModality windowModality)
{
QWidget *w = new QWidget(this);
w->setAttribute(Qt::WA_DeleteOnClose);
w->setWindowModality(windowModality);
w->setGeometry(0, 0, 0, 0);
w->show();
QTimer::singleShot(5000, w, SLOT(close()));
}
bool event(QEvent *event)
{
if (event->type() == QEvent::WindowBlocked)

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>558</width>
<height>268</height>
<width>519</width>
<height>207</height>
</rect>
</property>
<property name="windowTitle">
@ -20,31 +20,10 @@
<string>Select the type of window to create:</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QPushButton" name="windowButton">
<item row="2" column="1">
<widget class="QPushButton" name="windowModalNoParentButton">
<property name="text">
<string>Window</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="groupLeaderButton">
<property name="text">
<string>Window (Group Leader)</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="modelessButton">
<property name="text">
<string>Modeless Dialog</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="modelessNoParentButton">
<property name="text">
<string>Modeless Dialog (no parent)</string>
<string>Window Modal Dialog (no parent)</string>
</property>
</widget>
</item>
@ -55,10 +34,24 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="windowModalNoParentButton">
<item row="1" column="1">
<widget class="QPushButton" name="modelessNoParentButton">
<property name="text">
<string>Window Modal Dialog (no parent)</string>
<string>Modeless Dialog (no parent)</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="modelessButton">
<property name="text">
<string>Modeless Dialog</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="applicationModalButton">
<property name="text">
<string>Application Modal Dialog</string>
</property>
</widget>
</item>
@ -77,13 +70,6 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="applicationModalButton">
<property name="text">
<string>Application Modal Dialog</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="applicationModalNoParentButton">
<property name="text">
@ -91,35 +77,17 @@
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QLabel" name="modalChildWidgetInfoLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<item row="0" column="1">
<widget class="QPushButton" name="groupLeaderButton">
<property name="text">
<string>Note: Modal Child Widgets are invisible and hidden after 5 seconds.</string>
<string>Window (Group Leader)</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QPushButton" name="applicationModalChildButton">
<item row="0" column="0">
<widget class="QPushButton" name="windowButton">
<property name="text">
<string>Application Modal Child Widget</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QPushButton" name="windowModalChildButton">
<property name="text">
<string>Window Modal Child Widget</string>
<string>Window</string>
</property>
</widget>
</item>