summaryrefslogtreecommitdiffstats
path: root/tests/manual/diaglib/qwidgetdump.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/diaglib/qwidgetdump.cpp')
-rw-r--r--tests/manual/diaglib/qwidgetdump.cpp58
1 files changed, 11 insertions, 47 deletions
diff --git a/tests/manual/diaglib/qwidgetdump.cpp b/tests/manual/diaglib/qwidgetdump.cpp
index 21007e8df9..9fd79d32d4 100644
--- a/tests/manual/diaglib/qwidgetdump.cpp
+++ b/tests/manual/diaglib/qwidgetdump.cpp
@@ -1,41 +1,15 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwidgetdump.h"
-#include <QWidget>
-#if QT_VERSION > 0x050000
-# include <QtGui/QScreen>
-# include <QtGui/QWindow>
-#endif
#include <QApplication>
-#include <QtCore/QMetaObject>
+#include <QWidget>
+#include <QtGui/QScreen>
+#include <QtGui/QWindow>
+
#include <QtCore/QDebug>
+#include <QtCore/QMetaObject>
#include <QtCore/QTextStream>
namespace QtDiag {
@@ -99,11 +73,9 @@ static void dumpWidgetRecursion(QTextStream &str, const QWidget *w,
formatRect(str, w->geometry());
if (w->isWindow()) {
str << ' ' << w->logicalDpiX() << "DPI";
-#if QT_VERSION > 0x050600
- const qreal dpr = w->devicePixelRatioF();
+ const qreal dpr = w->devicePixelRatio();
if (!qFuzzyCompare(dpr, qreal(1)))
str << " dpr=" << dpr;
-#endif // Qt 5.6
const QRect normalGeometry = w->normalGeometry();
if (normalGeometry.isValid() && !normalGeometry.isEmpty() && normalGeometry != w->geometry()) {
str << " normal=";
@@ -130,13 +102,11 @@ static void dumpWidgetRecursion(QTextStream &str, const QWidget *w,
str << "maximumSize=" << maximumSize.width() << 'x' << maximumSize.height() << ' ';
}
str << '\n';
-#if QT_VERSION > 0x050000
if (const QWindow *win = w->windowHandle()) {
indentStream(str, 2 * (1 + depth));
formatWindow(str, win, options);
str << '\n';
}
-#endif // Qt 5
for (const QObject *co : w->children()) {
if (co->isWidgetType())
dumpWidgetRecursion(str, static_cast<const QWidget *>(co), options, depth + 1);
@@ -153,16 +123,10 @@ void dumpAllWidgets(FormatWindowOptions options, const QWidget *root)
topLevels.append(const_cast<QWidget *>(root));
else
topLevels = QApplication::topLevelWidgets();
- for (QWidget *tw : qAsConst(topLevels))
+ for (QWidget *tw : std::as_const(topLevels))
dumpWidgetRecursion(str, tw, options);
-#if QT_VERSION >= 0x050400
- {
- for (const QString &line : d.split(QLatin1Char('\n')))
- qDebug().noquote() << line;
- }
-#else
- qDebug("%s", qPrintable(d));
-#endif
+ for (const QString &line : d.split(QLatin1Char('\n')))
+ qDebug().noquote() << line;
}
} // namespace QtDiag