diff options
Diffstat (limited to 'tests/manual/diaglib/nativewindowdump_win.cpp')
-rw-r--r-- | tests/manual/diaglib/nativewindowdump_win.cpp | 53 |
1 files changed, 13 insertions, 40 deletions
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) |