diff options
Diffstat (limited to 'tests/manual/diaglib')
-rw-r--r-- | tests/manual/diaglib/debugproxystyle.cpp | 53 | ||||
-rw-r--r-- | tests/manual/diaglib/debugproxystyle.h | 29 | ||||
-rw-r--r-- | tests/manual/diaglib/diaglib.pri | 6 | ||||
-rw-r--r-- | tests/manual/diaglib/eventfilter.cpp | 61 | ||||
-rw-r--r-- | tests/manual/diaglib/eventfilter.h | 29 | ||||
-rw-r--r-- | tests/manual/diaglib/glinfo.cpp | 78 | ||||
-rw-r--r-- | tests/manual/diaglib/glinfo.h | 29 | ||||
-rw-r--r-- | tests/manual/diaglib/logwidget.cpp | 70 | ||||
-rw-r--r-- | tests/manual/diaglib/logwidget.h | 29 | ||||
-rw-r--r-- | tests/manual/diaglib/nativewindowdump.cpp | 38 | ||||
-rw-r--r-- | tests/manual/diaglib/nativewindowdump.h | 29 | ||||
-rw-r--r-- | tests/manual/diaglib/nativewindowdump_win.cpp | 53 | ||||
-rw-r--r-- | tests/manual/diaglib/qwidgetdump.cpp | 62 | ||||
-rw-r--r-- | tests/manual/diaglib/qwidgetdump.h | 29 | ||||
-rw-r--r-- | tests/manual/diaglib/qwindowdump.cpp | 81 | ||||
-rw-r--r-- | tests/manual/diaglib/qwindowdump.h | 29 | ||||
-rw-r--r-- | tests/manual/diaglib/textdump.cpp | 61 | ||||
-rw-r--r-- | tests/manual/diaglib/textdump.h | 29 |
18 files changed, 92 insertions, 703 deletions
diff --git a/tests/manual/diaglib/debugproxystyle.cpp b/tests/manual/diaglib/debugproxystyle.cpp index 809613cd1d..39aad93d17 100644 --- a/tests/manual/diaglib/debugproxystyle.cpp +++ b/tests/manual/diaglib/debugproxystyle.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 "debugproxystyle.h" #include "eventfilter.h" @@ -34,37 +9,21 @@ #include <QStyleOption> #include <QApplication> -#if QT_VERSION < 0x050000 -QDebug operator<<(QDebug d, const QPixmap &p) -{ - d << "QPixmap(" << p.size() << ')'; - return d; -} -#endif // QT_VERSION < 0x050000 - QDebug operator<<(QDebug debug, const QStyleOption *option) { -#if QT_VERSION >= 0x050000 QDebugStateSaver saver(debug); -# if QT_VERSION >= 0x050400 debug.noquote(); -# endif debug.nospace(); -#endif if (!option) { debug << "QStyleOption(0)"; return debug; } if (const QStyleOptionViewItem *ivo = qstyleoption_cast<const QStyleOptionViewItem *>(option)) { debug << "QStyleOptionViewItem("; -#if QT_VERSION >= 0x050000 debug << ivo->index; if (const int textSize = ivo->text.size()) debug << ", \"" << (textSize < 20 ? ivo->text : ivo->text.left(20) + QLatin1String("...")) << '"'; debug << ", "; -#else // Qt 5 - Q_UNUSED(ivo) -#endif } else { debug << "QStyleOption("; } @@ -72,10 +31,8 @@ QDebug operator<<(QDebug debug, const QStyleOption *option) << option->rect.x() << option->rect.y() << Qt::noforcesign; if (option->state != QStyle::State_None) debug << ", state=" << option->state; -#if QT_VERSION >= 0x050000 if (option->styleObject && !option->styleObject->isWidgetType()) debug << ", styleObject=" << QtDiag::formatQObject(option->styleObject); -#endif debug << ')'; return debug; } @@ -84,15 +41,9 @@ namespace QtDiag { DebugProxyStyle::DebugProxyStyle(QStyle *style) : QProxyStyle(style) { -#if QT_VERSION >= 0x050000 const qreal devicePixelRatio = qApp->devicePixelRatio(); -#else - const qreal devicePixelRatio = 1; -#endif qDebug() << __FUNCTION__ << QT_VERSION_STR -#if QT_VERSION >= 0x050000 << QGuiApplication::platformName() -#endif << style->objectName() << "devicePixelRatio=" << devicePixelRatio; } diff --git a/tests/manual/diaglib/debugproxystyle.h b/tests/manual/diaglib/debugproxystyle.h index 51bf79374e..160693a452 100644 --- a/tests/manual/diaglib/debugproxystyle.h +++ b/tests/manual/diaglib/debugproxystyle.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef DEBUGPROXYSTYLE_H #define DEBUGPROXYSTYLE_H diff --git a/tests/manual/diaglib/diaglib.pri b/tests/manual/diaglib/diaglib.pri index ace9caecc6..7ec657d9ab 100644 --- a/tests/manual/diaglib/diaglib.pri +++ b/tests/manual/diaglib/diaglib.pri @@ -10,9 +10,9 @@ HEADERS += \ $$PWD/qwindowdump.h \ $$PWD/nativewindowdump.h -win32:!winrt: { +win32: { SOURCES += $$PWD/nativewindowdump_win.cpp - QMAKE_USE += user32 + LIBS += -luser32 } else { SOURCES += $$PWD/nativewindowdump.cpp } @@ -38,7 +38,7 @@ contains(QT, opengl) { SOURCES += \ $$PWD/glinfo.cpp - QT += opengl + QT += opengl openglwidgets } DEFINES += QT_DIAG_LIB diff --git a/tests/manual/diaglib/eventfilter.cpp b/tests/manual/diaglib/eventfilter.cpp index b99d4099e3..e7896c278b 100644 --- a/tests/manual/diaglib/eventfilter.cpp +++ b/tests/manual/diaglib/eventfilter.cpp @@ -1,47 +1,16 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 "eventfilter.h" #include <QtGui/QMouseEvent> #include <QtCore/QDebug> #include <QtCore/QTextStream> -#if QT_VERSION >= 0x050000 -# if defined(QT_WIDGETS_LIB) -# define HAVE_APPLICATION -# endif -# if defined(QT_GUI_LIB) -# define HAVE_GUI_APPLICATION -# endif -#else // Qt 5 -# if defined(QT_GUI_LIB) -# define HAVE_APPLICATION -# endif +#if defined(QT_WIDGETS_LIB) +# define HAVE_APPLICATION +#endif +#if defined(QT_GUI_LIB) +# define HAVE_GUI_APPLICATION #endif #ifdef HAVE_APPLICATION @@ -82,9 +51,7 @@ void EventFilter::init(EventCategories eventCategories) m_eventTypes << QEvent::MouseMove << QEvent::NonClientAreaMouseMove; if (eventCategories & TouchEvents) { m_eventTypes << QEvent::TouchBegin << QEvent::TouchUpdate << QEvent::TouchEnd; -#if QT_VERSION >= 0x050000 m_eventTypes << QEvent::TouchCancel; -#endif } if (eventCategories & TabletEvents) { m_eventTypes << QEvent::TabletEnterProximity << QEvent::TabletLeaveProximity @@ -100,9 +67,7 @@ void EventFilter::init(EventCategories eventCategories) } if (eventCategories & FocusEvents) { m_eventTypes -#if QT_VERSION >= 0x050000 << QEvent::FocusAboutToChange -#endif << QEvent::FocusIn << QEvent::FocusOut; } if (eventCategories & GeometryEvents) @@ -110,17 +75,13 @@ void EventFilter::init(EventCategories eventCategories) if (eventCategories & PaintEvents) { m_eventTypes << QEvent::UpdateRequest << QEvent::Paint << QEvent::Show << QEvent::Hide; -#if QT_VERSION >= 0x050000 m_eventTypes << QEvent::Expose; -#endif } if (eventCategories & StateChangeEvents) { m_eventTypes << QEvent::WindowStateChange << QEvent::WindowBlocked << QEvent::WindowUnblocked -#if QT_VERSION >= 0x050000 << QEvent::ApplicationStateChange -#endif << QEvent::ApplicationActivate << QEvent::ApplicationDeactivate; } if (eventCategories & TimerEvents) @@ -131,9 +92,7 @@ void EventFilter::init(EventCategories eventCategories) } if (eventCategories & InputMethodEvents) { m_eventTypes << QEvent::InputMethod; -#if QT_VERSION >= 0x050000 m_eventTypes << QEvent::InputMethodQuery; -#endif } #ifndef QT_NO_GESTURES if (eventCategories & GestureEvents) { @@ -147,10 +106,8 @@ static inline bool matchesType(const QObject *o, EventFilter::ObjectTypes types) { if (o->isWidgetType()) return types & EventFilter::QWidgetType; -#if QT_VERSION >= 0x050000 if (o->isWindowType()) return types & EventFilter::QWindowType; -#endif return types & EventFilter::OtherType; } @@ -215,9 +172,7 @@ bool EventFilter::eventFilter(QObject *o, QEvent *e) formatObject(o, debug); debug << ' ' << e; switch (e->type()) { -#if QT_VERSION >= 0x050000 case QEvent::FocusAboutToChange: -#endif case QEvent::FocusIn: formatApplicationState(debug); break; @@ -230,9 +185,7 @@ bool EventFilter::eventFilter(QObject *o, QEvent *e) case QEvent::NonClientAreaMouseButtonPress: case QEvent::NonClientAreaMouseButtonRelease: case QEvent::NonClientAreaMouseMove: -# if QT_VERSION >= 0x050000 case QEvent::Enter: -# endif case QEvent::Leave: formatMouseState(o, debug); break; diff --git a/tests/manual/diaglib/eventfilter.h b/tests/manual/diaglib/eventfilter.h index a8740bb4e9..9db4918381 100644 --- a/tests/manual/diaglib/eventfilter.h +++ b/tests/manual/diaglib/eventfilter.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef _EVENTFILTER_ #define _EVENTFILTER_ diff --git a/tests/manual/diaglib/glinfo.cpp b/tests/manual/diaglib/glinfo.cpp index a955dd80ac..1abd4dd731 100644 --- a/tests/manual/diaglib/glinfo.cpp +++ b/tests/manual/diaglib/glinfo.cpp @@ -1,54 +1,20 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 "glinfo.h" -#include <QtOpenGL/QGLFunctions> -#include <QtOpenGL/QGLWidget> -#if QT_VERSION > 0x050000 -# if QT_VERSION >= 0x050400 -# include <QtWidgets/QOpenGLWidget> -# include <QtGui/QOpenGLWindow> -# else // 5.4 -# include <QtGui/QWindow> -# endif // 5.0..5.4 -# include <QtGui/QOpenGLContext> -# include <QtGui/QOpenGLFunctions> -# include <QtGui/QWindow> -#endif +#include <QOpenGLFunctions> +#include <QtOpenGLWidgets/QOpenGLWidget> +#include <QtOpenGL/QOpenGLWindow> +#include <QtGui/QOpenGLContext> +#include <QtGui/QOpenGLFunctions> +#include <QtGui/QWindow> #include <QtCore/QDebug> #include <QtCore/QString> #include <QtCore/QTimer> namespace QtDiag { -#if QT_VERSION > 0x050000 - static QString getGlString(const QOpenGLContext *ctx, GLenum name) { if (const GLubyte *p = ctx->functions()->glGetString(name)) @@ -63,45 +29,19 @@ static QString glInfo(const QOpenGLContext *ctx) + getGlString(ctx, GL_RENDERER); } -static QString glInfo(const QGLContext *ctx) -{ - return glInfo(ctx->contextHandle()); -} - QString glInfo(const QObject *o) { -# if QT_VERSION >= 0x050400 if (o->isWindowType()) { if (const QOpenGLWindow *oglw = qobject_cast<const QOpenGLWindow *>(o)) return glInfo(oglw->context()); return QString(); } -# endif // 5.4 + if (o->isWidgetType()) { - if (const QGLWidget *g = qobject_cast<const QGLWidget *>(o)) - return glInfo(g->context()); -# if QT_VERSION >= 0x050400 if (const QOpenGLWidget *g = qobject_cast<const QOpenGLWidget *>(o)) return glInfo(g->context()); -# endif // 5.4 } return QString(); } -#else // Qt4: - -static QString getGlString(GLenum name) -{ - if (const GLubyte *p = glGetString(name)) - return QString::fromLatin1(reinterpret_cast<const char *>(p)); - return QString(); -} - -QString glInfo(const QObject *) -{ - return getGlString(GL_VENDOR) + QLatin1Char('\n') + getGlString(GL_RENDERER); -} - -#endif - } // namespace QtDiag diff --git a/tests/manual/diaglib/glinfo.h b/tests/manual/diaglib/glinfo.h index 2903a98d2f..d633ae8a2f 100644 --- a/tests/manual/diaglib/glinfo.h +++ b/tests/manual/diaglib/glinfo.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef _GLINFO_ #define _GLINFO_ diff --git a/tests/manual/diaglib/logwidget.cpp b/tests/manual/diaglib/logwidget.cpp index 18a82d819e..e49a78d454 100644 --- a/tests/manual/diaglib/logwidget.cpp +++ b/tests/manual/diaglib/logwidget.cpp @@ -1,41 +1,14 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "logwidget.h" -#if QT_VERSION >= 0x050000 -# include <QtCore/qlogging.h> -# include <QtCore/QLibraryInfo> -#endif #include <QApplication> #include <QStyle> #include <QtCore/QDebug> -#include <QtCore/QVector> +#include <QtCore/QLibraryInfo> +#include <QtCore/QList> +#include <QtCore/qlogging.h> #include <QtCore/QStringList> #include <iostream> @@ -60,19 +33,13 @@ LogWidget::~LogWidget() QString LogWidget::startupMessage() { QString result; -#if QT_VERSION >= 0x050300 result += QLatin1String(QLibraryInfo::build()); -#else - result += QLatin1String("Qt ") + QLatin1String(QT_VERSION_STR); -#endif const QCoreApplication *coreApp = QCoreApplication::instance(); -#if QT_VERSION >= 0x050000 if (qobject_cast<const QGuiApplication *>(coreApp)) { result += QLatin1Char(' '); result += QGuiApplication::platformName(); } -#endif if (qobject_cast<const QApplication *>(coreApp)) { result += QLatin1Char(' '); result += QApplication::style()->objectName(); @@ -88,9 +55,9 @@ QString LogWidget::startupMessage() return result; } -static const QVector<QString> &messageTypes() +static const QList<QString> &messageTypes() { - static QVector<QString> result; + static QList<QString> result; if (result.isEmpty()) { result << QLatin1String("debug") << QLatin1String("warn") << QLatin1String("critical") << QLatin1String("fatal") @@ -122,36 +89,17 @@ static void messageHandler(QtMsgType type, const QString &text) n++; } -#if QT_VERSION >= 0x050000 - -static void qt5MessageHandler(QtMsgType type, const QMessageLogContext &, const QString &text) +static void qtMessageHandler(QtMsgType type, const QMessageLogContext &, const QString &text) { messageHandler(type, text); } void LogWidget::install() { - qInstallMessageHandler(qt5MessageHandler); + qInstallMessageHandler(qtMessageHandler); qInfo("%s", qPrintable(LogWidget::startupMessage())); } void LogWidget::uninstall() { qInstallMessageHandler(nullptr); } -#else // Qt 5 - -static QtMsgHandler oldHandler = 0; - -static void qt4MessageHandler(QtMsgType type, const char *text) -{ messageHandler(type, QString::fromLocal8Bit(text)); } - -void LogWidget::install() -{ - oldHandler = qInstallMsgHandler(qt4MessageHandler); - qDebug("%s", qPrintable(LogWidget::startupMessage())); -} - -void LogWidget::uninstall() { qInstallMsgHandler(oldHandler); } - -#endif // Qt 4 - void LogWidget::appendText(const QString &message) { appendPlainText(message); diff --git a/tests/manual/diaglib/logwidget.h b/tests/manual/diaglib/logwidget.h index b1ce43f231..921cc5be71 100644 --- a/tests/manual/diaglib/logwidget.h +++ b/tests/manual/diaglib/logwidget.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef LOGWIDGET_H #define LOGWIDGET_H diff --git a/tests/manual/diaglib/nativewindowdump.cpp b/tests/manual/diaglib/nativewindowdump.cpp index a854e8a790..d384f05d57 100644 --- a/tests/manual/diaglib/nativewindowdump.cpp +++ b/tests/manual/diaglib/nativewindowdump.cpp @@ -1,52 +1,22 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 "nativewindowdump.h" -#if QT_VERSION >= 0x050000 -# include <QtGui/QGuiApplication> -# include <qpa/qplatformnativeinterface.h> -#endif - +#include <QtGui/QGuiApplication> +#include <qpa/qplatformnativeinterface.h> #include <QtCore/QDebug> namespace QtDiag { void dumpNativeWindows(WId wid) { -#if QT_VERSION >= 0x050000 QPlatformNativeInterface *ni = QGuiApplication::platformNativeInterface(); QString result; QMetaObject::invokeMethod(ni, "dumpNativeWindows", Qt::DirectConnection, Q_RETURN_ARG(QString, result), Q_ARG(WId, wid)); qDebug().noquote() << result; -#endif // Qt 5 } void dumpNativeQtTopLevels() diff --git a/tests/manual/diaglib/nativewindowdump.h b/tests/manual/diaglib/nativewindowdump.h index e848724b13..6fe2995dc8 100644 --- a/tests/manual/diaglib/nativewindowdump.h +++ b/tests/manual/diaglib/nativewindowdump.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef _NATIVEWINDOWDUMP_ #define _NATIVEWINDOWDUMP_ diff --git a/tests/manual/diaglib/nativewindowdump_win.cpp b/tests/manual/diaglib/nativewindowdump_win.cpp index d91e673d1c..b2f8be861b 100644 --- a/tests/manual/diaglib/nativewindowdump_win.cpp +++ b/tests/manual/diaglib/nativewindowdump_win.cpp @@ -1,39 +1,14 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 "nativewindowdump.h" #include "qwindowdump.h" -#include <QtCore/QTextStream> -#include <QtCore/QSharedPointer> #include <QtCore/QDebug> +#include <QtCore/QList> #include <QtCore/QRect> -#include <QtCore/QVector> +#include <QtCore/QSharedPointer> +#include <QtCore/QTextStream> #include <QtCore/qt_windows.h> @@ -41,6 +16,8 @@ # define WS_EX_NOREDIRECTIONBITMAP 0x00200000L #endif +using namespace Qt; + namespace QtDiag { struct DumpContext { @@ -69,7 +46,7 @@ static QTextStream &operator<<(QTextStream &str, const QSize &s) static QTextStream &operator<<(QTextStream &str, const QRect &rect) { - str << rect.size() << forcesign << rect.x() << rect.y() << noforcesign; + str << rect.size() << Qt::forcesign << rect.x() << rect.y() << Qt::noforcesign; return str; } @@ -110,7 +87,7 @@ static bool isTopLevel(HWND hwnd) static void formatNativeWindow(HWND hwnd, QTextStream &str) { - str << hex << showbase << quintptr(hwnd) << noshowbase << dec; + str << Qt::hex << Qt::showbase << quintptr(hwnd) << Qt::noshowbase << Qt::dec; const bool topLevel = isTopLevel(hwnd); if (topLevel) @@ -136,7 +113,7 @@ static void formatNativeWindow(HWND hwnd, QTextStream &str) if (GetClassName(hwnd, buf, sizeof(buf)/sizeof(buf[0]))) str << '"' << QString::fromWCharArray(buf) << '"'; - str << hex << showbase; + str << Qt::hex << Qt::showbase; if (const LONG_PTR style = GetWindowLongPtr(hwnd, GWL_STYLE)) { str << " style=" << style; debugWinStyle(str, style, WS_OVERLAPPED) @@ -208,7 +185,7 @@ static void formatNativeWindow(HWND hwnd, QTextStream &str) if (const ULONG_PTR wndProc = GetClassLongPtr(hwnd, GCLP_WNDPROC)) str << " wndProc=" << wndProc; - str << noshowbase << dec; + str << Qt::noshowbase << Qt::dec; if (GetWindowModuleFileName(hwnd, buf, sizeof(buf)/sizeof(buf[0]))) str << " module=\"" << QString::fromWCharArray(buf) << '"'; @@ -251,20 +228,16 @@ static void dumpNativeWindowRecursionByZ(HWND hwnd, DumpContext *dc) } } -typedef QVector<WId> WIdVector; +typedef QList<WId> WIdVector; static void dumpNativeWindows(const WIdVector& wins) { DumpContext dc; QString s; dc.stream = QSharedPointer<QTextStream>(new QTextStream(&s)); - foreach (WId win, wins) + for (WId win : wins) dumpNativeWindowRecursion(reinterpret_cast<HWND>(win), &dc); -#if QT_VERSION >= 0x050400 qDebug().noquote() << s; -#else - qDebug("%s", qPrintable(s)); -#endif } void dumpNativeWindows(WId rootIn) diff --git a/tests/manual/diaglib/qwidgetdump.cpp b/tests/manual/diaglib/qwidgetdump.cpp index 926d2aaf35..9fd79d32d4 100644 --- a/tests/manual/diaglib/qwidgetdump.cpp +++ b/tests/manual/diaglib/qwidgetdump.cpp @@ -1,41 +1,15 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 { @@ -43,7 +17,7 @@ namespace QtDiag { static const char *qtWidgetClasses[] = { "QAbstractItemView", "QAbstractScrollArea", "QAbstractSlider", "QAbstractSpinBox", "QCalendarWidget", "QCheckBox", "QColorDialog", "QColumnView", "QComboBox", - "QCommandLinkButton", "QDateEdit", "QDateTimeEdit", "QDesktopWidget", "QDial", + "QCommandLinkButton", "QDateEdit", "QDateTimeEdit", "QDial", "QDialog", "QDialogButtonBox", "QDockWidget", "QDoubleSpinBox", "QErrorMessage", "QFileDialog", "QFontComboBox", "QFontDialog", "QFrame", "QGraphicsView", "QGroupBox", "QHeaderView", "QInputDialog", "QLCDNumber", "QLabel", "QLineEdit", @@ -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,14 +102,12 @@ 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 - foreach (const QObject *co, w->children()) { + 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(); - foreach (QWidget *tw, topLevels) + for (QWidget *tw : std::as_const(topLevels)) dumpWidgetRecursion(str, tw, options); -#if QT_VERSION >= 0x050400 - { - foreach (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 diff --git a/tests/manual/diaglib/qwidgetdump.h b/tests/manual/diaglib/qwidgetdump.h index c9b2db72dd..5bac7395a8 100644 --- a/tests/manual/diaglib/qwidgetdump.h +++ b/tests/manual/diaglib/qwidgetdump.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef _WIDGETDUMP_ #define _WIDGETDUMP_ diff --git a/tests/manual/diaglib/qwindowdump.cpp b/tests/manual/diaglib/qwindowdump.cpp index 2be26ff142..9c71c0ae9b 100644 --- a/tests/manual/diaglib/qwindowdump.cpp +++ b/tests/manual/diaglib/qwindowdump.cpp @@ -1,48 +1,20 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 "qwindowdump.h" -#if QT_VERSION > 0x050000 -# include <QtGui/QGuiApplication> -# include <QtGui/QScreen> -# include <QtGui/QWindow> -# include <qpa/qplatformwindow.h> -# include <private/qwindow_p.h> -# if QT_VERSION >= 0x050600 -# include <private/qhighdpiscaling_p.h> -# endif -#endif +#include <QtGui/QGuiApplication> +#include <QtGui/QScreen> +#include <QtGui/QWindow> +#include <QtCore/QDebug> #include <QtCore/QMetaObject> #include <QtCore/QRect> -#include <QtCore/QDebug> #include <QtCore/QTextStream> +#include <qpa/qplatformwindow.h> +#include <private/qwindow_p.h> +#include <private/qhighdpiscaling_p.h> + namespace QtDiag { void indentStream(QTextStream &s, int indent) @@ -61,8 +33,8 @@ void formatObject(QTextStream &str, const QObject *o) void formatRect(QTextStream &str, const QRect &geom) { - str << geom.width() << 'x' << geom.height() << Qt::forcesign << geom.x() << geom.y() - << Qt::noforcesign; + str << geom.width() << 'x' << geom.height() << Qt::forcesign + << geom.x() << geom.y() << Qt::noforcesign; } #define debugType(s, type, typeConstant) \ @@ -87,10 +59,8 @@ void formatWindowFlags(QTextStream &str, Qt::WindowFlags flags) debugType(str, windowType, Qt::SplashScreen) debugType(str, windowType, Qt::Desktop) debugType(str, windowType, Qt::SubWindow) -#if QT_VERSION > 0x050000 debugType(str, windowType, Qt::ForeignWindow) debugType(str, windowType, Qt::CoverWindow) -#endif debugFlag(str, flags, Qt::MSWindowsFixedSizeDialogHint) debugFlag(str, flags, Qt::MSWindowsOwnDC) debugFlag(str, flags, Qt::X11BypassWindowManagerHint) @@ -103,20 +73,16 @@ void formatWindowFlags(QTextStream &str, Qt::WindowFlags flags) debugFlag(str, flags, Qt::WindowShadeButtonHint) debugFlag(str, flags, Qt::WindowStaysOnTopHint) debugFlag(str, flags, Qt::CustomizeWindowHint) -#if QT_VERSION > 0x050000 debugFlag(str, flags, Qt::WindowTransparentForInput) debugFlag(str, flags, Qt::WindowOverridesSystemGestures) debugFlag(str, flags, Qt::WindowDoesNotAcceptFocus) debugFlag(str, flags, Qt::NoDropShadowWindowHint) debugFlag(str, flags, Qt::WindowFullscreenButtonHint) -#endif debugFlag(str, flags, Qt::WindowStaysOnBottomHint) debugFlag(str, flags, Qt::MacWindowToolBarButtonHint) debugFlag(str, flags, Qt::BypassGraphicsProxyWidget) } -#if QT_VERSION > 0x050000 - void formatWindow(QTextStream &str, const QWindow *w, FormatWindowOptions options) { const QPlatformWindow *pw = w->handle(); @@ -137,10 +103,8 @@ void formatWindow(QTextStream &str, const QWindow *w, FormatWindowOptions option formatRect(str, w->geometry()); if (w->isTopLevel()) { str << " \"" << w->screen()->name() << "\" "; -#if QT_VERSION >= 0x050600 if (QHighDpiScaling::isActive()) str << "factor=" << QHighDpiScaling::factor(w) << " dpr=" << w->devicePixelRatio(); -#endif } if (!(options & DontPrintWindowFlags)) { str << ' '; @@ -163,7 +127,7 @@ static void dumpWindowRecursion(QTextStream &str, const QWindow *w, { indentStream(str, 2 * depth); formatWindow(str, w, options); - foreach (const QObject *co, w->children()) { + for (const QObject *co : w->children()) { if (co->isWindowType()) dumpWindowRecursion(str, static_cast<const QWindow *>(co), options, depth + 1); } @@ -174,26 +138,9 @@ void dumpAllWindows(FormatWindowOptions options) QString d; QTextStream str(&d); str << "### QWindows:\n"; - foreach (QWindow *w, QGuiApplication::topLevelWindows()) + for (QWindow *w : QGuiApplication::topLevelWindows()) dumpWindowRecursion(str, w, options); -#if QT_VERSION >= 0x050400 qDebug().noquote() << d; -#else - qDebug() << d; -#endif } -#else // Qt 5 -class QWindow {}; - -void formatWindow(QTextStream &, const QWindow *, FormatWindowOptions) -{ -} - -void dumpAllWindows(FormatWindowOptions options) -{ -} - -#endif // Qt 4 - } // namespace QtDiag diff --git a/tests/manual/diaglib/qwindowdump.h b/tests/manual/diaglib/qwindowdump.h index 9d7491eab2..1fdc1f1bcd 100644 --- a/tests/manual/diaglib/qwindowdump.h +++ b/tests/manual/diaglib/qwindowdump.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef _WINDOWDUMP_ #define _WINDOWDUMP_ diff --git a/tests/manual/diaglib/textdump.cpp b/tests/manual/diaglib/textdump.cpp index 33455a2a56..0256baba51 100644 --- a/tests/manual/diaglib/textdump.cpp +++ b/tests/manual/diaglib/textdump.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 "textdump.h" @@ -41,28 +16,20 @@ struct EnumLookup { static const EnumLookup specialCharactersEnumLookup[] = { {QChar::Null, "Null"}, -#if QT_VERSION >= 0x050000 {QChar::Tabulation, "Tabulation"}, {QChar::LineFeed, "LineFeed"}, -# if QT_VERSION >= 0x050e00 {QChar::FormFeed, "FormFeed"}, -# endif {QChar::CarriageReturn, "CarriageReturn"}, {QChar::Space, "Space"}, -#endif {QChar::Nbsp, "Nbsp"}, -#if QT_VERSION >= 0x050000 {QChar::SoftHyphen, "SoftHyphen"}, -#endif {QChar::ReplacementCharacter, "ReplacementCharacter"}, {QChar::ObjectReplacementCharacter, "ObjectReplacementCharacter"}, {QChar::ByteOrderMark, "ByteOrderMark"}, {QChar::ByteOrderSwapped, "ByteOrderSwapped"}, {QChar::ParagraphSeparator, "ParagraphSeparator"}, {QChar::LineSeparator, "LineSeparator"}, -#if QT_VERSION >= 0x050000 {QChar::LastValidCodePoint, "LastValidCodePoint"} -#endif }; static const EnumLookup categoryEnumLookup[] = @@ -105,8 +72,6 @@ static const EnumLookup categoryEnumLookup[] = {QChar::Symbol_Other, "Symbol_Other"}, }; -#if QT_VERSION >= 0x050100 - static const EnumLookup scriptEnumLookup[] = { {QChar::Script_Unknown, "Script_Unknown"}, @@ -221,7 +186,6 @@ static const EnumLookup scriptEnumLookup[] = {QChar::Script_SoraSompeng, "Script_SoraSompeng"}, {QChar::Script_Takri, "Script_Takri"}, -#if QT_VERSION >= 0x050500 {QChar::Script_CaucasianAlbanian, "Script_CaucasianAlbanian"}, {QChar::Script_BassaVah, "Script_BassaVah"}, {QChar::Script_Duployan, "Script_Duployan"}, @@ -245,20 +209,15 @@ static const EnumLookup scriptEnumLookup[] = {QChar::Script_Khudawadi, "Script_Khudawadi"}, {QChar::Script_Tirhuta, "Script_Tirhuta"}, {QChar::Script_WarangCiti, "Script_WarangCiti"}, -#endif // Qt 5.5 -#if QT_VERSION >= 0x050600 {QChar::Script_Ahom, "Script_Ahom"}, {QChar::Script_AnatolianHieroglyphs, "Script_AnatolianHieroglyphs"}, {QChar::Script_Hatran, "Script_Hatran"}, {QChar::Script_Multani, "Script_Multani"}, {QChar::Script_OldHungarian, "Script_OldHungarian"}, {QChar::Script_SignWriting, "Script_SignWriting"}, -#endif // Qt 5.5 }; -#endif // Qt 5.1 - static const EnumLookup directionEnumLookup[] = { {QChar::DirL, "DirL"}, @@ -280,12 +239,10 @@ static const EnumLookup directionEnumLookup[] = {QChar::DirPDF, "DirPDF"}, {QChar::DirNSM, "DirNSM"}, {QChar::DirBN, "DirBN"}, -#if QT_VERSION >= 0x050000 {QChar::DirLRI, "DirLRI"}, {QChar::DirRLI, "DirRLI"}, {QChar::DirFSI, "DirFSI"}, {QChar::DirPDI, "DirPDI"}, -#endif }; static const EnumLookup decompositionEnumLookup[] = @@ -310,8 +267,6 @@ static const EnumLookup decompositionEnumLookup[] = {QChar::Fraction, "Fraction"}, }; -#if QT_VERSION >= 0x050000 - static const EnumLookup joiningTypeEnumLookup[] = { {QChar::Joining_None, "Joining_None"}, @@ -322,8 +277,6 @@ static const EnumLookup joiningTypeEnumLookup[] = {QChar::Joining_Transparent, "Joining_Transparent"} }; -#endif // Qt 5 - static const EnumLookup combiningClassEnumLookup[] = { {QChar::Combining_BelowLeftAttached, "Combining_BelowLeftAttached"}, @@ -361,20 +314,14 @@ static const EnumLookup unicodeVersionEnumLookup[] = {QChar::Unicode_4_0, "Unicode_4_0"}, {QChar::Unicode_4_1, "Unicode_4_1"}, {QChar::Unicode_5_0, "Unicode_5_0"}, -#if QT_VERSION >= 0x050000 {QChar::Unicode_5_1, "Unicode_5_1"}, {QChar::Unicode_5_2, "Unicode_5_2"}, {QChar::Unicode_6_0, "Unicode_6_0"}, {QChar::Unicode_6_1, "Unicode_6_1"}, {QChar::Unicode_6_2, "Unicode_6_2"}, {QChar::Unicode_6_3, "Unicode_6_3"}, -#if QT_VERSION >= 0x050500 {QChar::Unicode_7_0, "Unicode_7_0"}, -#endif // Qt 5.5 -#if QT_VERSION >= 0x050600 {QChar::Unicode_8_0, "Unicode_8_0"}, -#endif // Qt 5.6 -#endif // Qt 5 }; static const EnumLookup *enumLookup(int v, const EnumLookup *array, size_t size) @@ -423,7 +370,6 @@ static void formatCharacter(QTextStream &str, const QChar &qc, FormattingContext << enumName(category, categoryEnumLookup, sizeof(categoryEnumLookup) / sizeof(EnumLookup)); context.category = category; } -#if QT_VERSION >= 0x050100 const int script = qc.script(); if (script != context.script) { str << " script=" @@ -431,21 +377,18 @@ static void formatCharacter(QTextStream &str, const QChar &qc, FormattingContext << '(' << script << ')'; context.script = script; } -#endif // Qt 5 const int direction = qc.direction(); if (direction != context.direction) { str << " direction=" << enumName(direction, directionEnumLookup, sizeof(directionEnumLookup) / sizeof(EnumLookup)); context.direction = direction; } -#if QT_VERSION >= 0x050000 const int joiningType = qc.joiningType(); if (joiningType != context.joiningType) { str << " joiningType=" << enumName(joiningType, joiningTypeEnumLookup, sizeof(joiningTypeEnumLookup) / sizeof(EnumLookup)); context.joiningType = joiningType; } -#endif // Qt 5QWidget const int decompositionTag = qc.decompositionTag(); if (decompositionTag != context.decompositionTag) { str << " decomposition=" diff --git a/tests/manual/diaglib/textdump.h b/tests/manual/diaglib/textdump.h index 5bfc73ac78..0885c2d29c 100644 --- a/tests/manual/diaglib/textdump.h +++ b/tests/manual/diaglib/textdump.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef TEXTDUMP_H #define TEXTDUMP_H |