summaryrefslogtreecommitdiffstats
path: root/tests/manual/qscreen
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/qscreen')
-rw-r--r--tests/manual/qscreen/main.cpp11
-rw-r--r--tests/manual/qscreen/propertywatcher.cpp3
2 files changed, 12 insertions, 2 deletions
diff --git a/tests/manual/qscreen/main.cpp b/tests/manual/qscreen/main.cpp
index 905c7d6f77..c085d3fd5b 100644
--- a/tests/manual/qscreen/main.cpp
+++ b/tests/manual/qscreen/main.cpp
@@ -49,6 +49,9 @@
int i = 0;
+typedef QHash<QScreen*, PropertyWatcher*> ScreensHash;
+Q_GLOBAL_STATIC(ScreensHash, props);
+
void updateSiblings(PropertyWatcher* w)
{
QLineEdit *siblingsField = w->findChild<QLineEdit *>("siblings");
@@ -88,12 +91,19 @@ void screenAdded(QScreen* screen)
geom.moveCenter(screen->geometry().center());
w->move(geom.topLeft());
+ props->insert(screen, w);
+
// workaround for the fact that virtualSiblings is not a property,
// thus there is no change notification:
// allow the user to update the field manually
QObject::connect(w, &PropertyWatcher::updatedAllFields, &updateSiblings);
}
+void screenRemoved(QScreen* screen)
+{
+ delete props->take(screen);
+}
+
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
@@ -101,5 +111,6 @@ int main(int argc, char *argv[])
foreach (QScreen *screen, screens)
screenAdded(screen);
QObject::connect((const QGuiApplication*)QGuiApplication::instance(), &QGuiApplication::screenAdded, &screenAdded);
+ QObject::connect((const QGuiApplication*)QGuiApplication::instance(), &QGuiApplication::screenRemoved, &screenRemoved);
return a.exec();
}
diff --git a/tests/manual/qscreen/propertywatcher.cpp b/tests/manual/qscreen/propertywatcher.cpp
index 2213f4ac1d..9e34c69799 100644
--- a/tests/manual/qscreen/propertywatcher.cpp
+++ b/tests/manual/qscreen/propertywatcher.cpp
@@ -82,6 +82,5 @@ void PropertyWatcher::updateAllFields()
void PropertyWatcher::subjectDestroyed()
{
- hide();
- deleteLater();
+ qDebug("screen destroyed");
}