summaryrefslogtreecommitdiffstats
path: root/tests/manual/qscreen
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/qscreen')
-rw-r--r--tests/manual/qscreen/CMakeLists.txt10
-rw-r--r--tests/manual/qscreen/main.cpp4
-rw-r--r--tests/manual/qscreen/propertyfield.cpp5
-rw-r--r--tests/manual/qscreen/propertyfield.h6
-rw-r--r--tests/manual/qscreen/propertywatcher.cpp6
-rw-r--r--tests/manual/qscreen/propertywatcher.h2
6 files changed, 17 insertions, 16 deletions
diff --git a/tests/manual/qscreen/CMakeLists.txt b/tests/manual/qscreen/CMakeLists.txt
index 22c1401f1d..4149310df4 100644
--- a/tests/manual/qscreen/CMakeLists.txt
+++ b/tests/manual/qscreen/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qscreen.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## qscreen Binary:
@@ -9,10 +10,9 @@ qt_internal_add_manual_test(qscreen
main.cpp
propertyfield.cpp propertyfield.h
propertywatcher.cpp propertywatcher.h
- PUBLIC_LIBRARIES
+ NO_PCH_SOURCES
+ main.cpp # undef QT_NO_FOREACH
+ LIBRARIES
Qt::Gui
Qt::Widgets
)
-
-#### Keys ignored in scope 1:.:.:qscreen.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/manual/qscreen/main.cpp b/tests/manual/qscreen/main.cpp
index f6c22e88a8..f85271923c 100644
--- a/tests/manual/qscreen/main.cpp
+++ b/tests/manual/qscreen/main.cpp
@@ -1,5 +1,7 @@
// 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
+
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include "propertywatcher.h"
#include <QApplication>
diff --git a/tests/manual/qscreen/propertyfield.cpp b/tests/manual/qscreen/propertyfield.cpp
index 7ed2759634..1a637e302f 100644
--- a/tests/manual/qscreen/propertyfield.cpp
+++ b/tests/manual/qscreen/propertyfield.cpp
@@ -1,11 +1,11 @@
// 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 "propertyfield.h"
#include <QDebug>
PropertyField::PropertyField(QObject* subject, const QMetaProperty& prop, QWidget *parent)
- : QLineEdit(parent), m_subject(subject), m_lastChangeTime(QTime::currentTime()), m_prop(prop)
+ : QLineEdit(parent), m_subject(subject), m_lastChangeTime(), m_prop(prop)
, m_defaultBrush(palette().brush(QPalette::Active, QPalette::Text))
{
setReadOnly(true);
@@ -57,7 +57,6 @@ void PropertyField::propertyChanged()
if (m_lastText.isEmpty()) {
m_lastText = text;
m_lastTextShowing = text;
- m_lastChangeTime = QTime::currentTime().addSecs(-5);
}
qDebug() << " " << QString::fromUtf8(m_prop.name()) << ':' << val;
diff --git a/tests/manual/qscreen/propertyfield.h b/tests/manual/qscreen/propertyfield.h
index 91960c892a..62e9f9e99c 100644
--- a/tests/manual/qscreen/propertyfield.h
+++ b/tests/manual/qscreen/propertyfield.h
@@ -1,12 +1,12 @@
// 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
#ifndef PROPERTYFIELD_H
#define PROPERTYFIELD_H
#include <QLineEdit>
#include <QMetaProperty>
-#include <QTime>
+#include <QElapsedTimer>
/*!
A QLineEdit for viewing the text form of a property on an object.
@@ -31,7 +31,7 @@ private:
QObject* m_subject;
QString m_lastText;
QString m_lastTextShowing;
- QTime m_lastChangeTime;
+ QElapsedTimer m_lastChangeTime;
const QMetaProperty m_prop;
QBrush m_defaultBrush;
};
diff --git a/tests/manual/qscreen/propertywatcher.cpp b/tests/manual/qscreen/propertywatcher.cpp
index 5eec9f275b..6ba6f5c351 100644
--- a/tests/manual/qscreen/propertywatcher.cpp
+++ b/tests/manual/qscreen/propertywatcher.cpp
@@ -1,5 +1,5 @@
// 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 "propertywatcher.h"
#include <QMetaProperty>
@@ -85,8 +85,8 @@ void PropertyWatcher::setSubject(QObject *s, const QString &annotation)
void PropertyWatcher::updateAllFields()
{
- QList<PropertyField *> fields = findChildren<PropertyField*>();
- foreach (PropertyField *field, fields)
+ const QList<PropertyField *> fields = findChildren<PropertyField*>();
+ for (PropertyField *field : fields)
field->propertyChanged();
emit updatedAllFields(this);
}
diff --git a/tests/manual/qscreen/propertywatcher.h b/tests/manual/qscreen/propertywatcher.h
index eaefd60beb..061d94964e 100644
--- a/tests/manual/qscreen/propertywatcher.h
+++ b/tests/manual/qscreen/propertywatcher.h
@@ -1,5 +1,5 @@
// 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
#ifndef PROPERTY_WATCHER_H
#define PROPERTY_WATCHER_H