summaryrefslogtreecommitdiffstats
path: root/tests/manual/diaglib
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-01-28 11:46:16 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-03-25 14:30:24 +0100
commitcc333f5faf2fa892ca0e321915263cab5d793191 (patch)
treebf996aebbf68a6e5df335acc0da41ba3a216d1fb /tests/manual/diaglib
parent46ebd11e66f6f3180043a7258b46a1aff79a69f8 (diff)
Diaglib: Fix build
Use range-based for and fix deprecation warnings. Change-Id: I54152b2598e9e4a7a3cc9db9b7072bbabcef7fcf Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests/manual/diaglib')
-rw-r--r--tests/manual/diaglib/debugproxystyle.cpp2
-rw-r--r--tests/manual/diaglib/nativewindowdump_win.cpp10
-rw-r--r--tests/manual/diaglib/qwidgetdump.cpp10
-rw-r--r--tests/manual/diaglib/qwindowdump.cpp10
-rw-r--r--tests/manual/diaglib/textdump.cpp6
5 files changed, 19 insertions, 19 deletions
diff --git a/tests/manual/diaglib/debugproxystyle.cpp b/tests/manual/diaglib/debugproxystyle.cpp
index ed35af5962..73e9e7ce54 100644
--- a/tests/manual/diaglib/debugproxystyle.cpp
+++ b/tests/manual/diaglib/debugproxystyle.cpp
@@ -69,7 +69,7 @@ QDebug operator<<(QDebug debug, const QStyleOption *option)
debug << "QStyleOption(";
}
debug << "rect=" << option->rect.width() << 'x' << option->rect.height()
- << forcesign << option->rect.x() << option->rect.y() << noforcesign;
+ << Qt::forcesign << option->rect.x() << option->rect.y() << Qt::noforcesign;
if (option->state != QStyle::State_None)
debug << ", state=" << option->state;
#if QT_VERSION >= 0x050000
diff --git a/tests/manual/diaglib/nativewindowdump_win.cpp b/tests/manual/diaglib/nativewindowdump_win.cpp
index d91e673d1c..256142462f 100644
--- a/tests/manual/diaglib/nativewindowdump_win.cpp
+++ b/tests/manual/diaglib/nativewindowdump_win.cpp
@@ -69,7 +69,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 +110,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 +136,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 +208,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) << '"';
@@ -258,7 +258,7 @@ 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;
diff --git a/tests/manual/diaglib/qwidgetdump.cpp b/tests/manual/diaglib/qwidgetdump.cpp
index 5a2966021b..9e175cd3cf 100644
--- a/tests/manual/diaglib/qwidgetdump.cpp
+++ b/tests/manual/diaglib/qwidgetdump.cpp
@@ -86,14 +86,14 @@ static void dumpWidgetRecursion(QTextStream &str, const QWidget *w,
formatWidgetClass(str, w);
str << ' ' << (w->isVisible() ? "[visible] " : "[hidden] ");
if (const WId nativeWinId = w->internalWinId())
- str << "[native: " << hex << showbase << nativeWinId << dec << noshowbase << "] ";
+ str << "[native: " << Qt::hex << Qt::showbase << nativeWinId << Qt::dec << Qt::noshowbase << "] ";
if (w->isWindow())
str << "[top] ";
str << (w->testAttribute(Qt::WA_Mapped) ? "[mapped] " : "[not mapped] ");
if (w->testAttribute(Qt::WA_DontCreateNativeAncestors))
str << "[NoNativeAncestors] ";
if (const int states = w->windowState())
- str << "windowState=" << hex << showbase << states << dec << noshowbase << ' ';
+ str << "windowState=" << Qt::hex << Qt::showbase << states << Qt::dec << Qt::noshowbase << ' ';
formatRect(str, w->geometry());
if (w->isWindow()) {
str << ' ' << w->logicalDpiX() << "DPI";
@@ -135,7 +135,7 @@ static void dumpWidgetRecursion(QTextStream &str, const QWidget *w,
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);
}
@@ -151,11 +151,11 @@ void dumpAllWidgets(FormatWindowOptions options, const QWidget *root)
topLevels.append(const_cast<QWidget *>(root));
else
topLevels = QApplication::topLevelWidgets();
- foreach (QWidget *tw, topLevels)
+ for (QWidget *tw : qAsConst(topLevels))
dumpWidgetRecursion(str, tw, options);
#if QT_VERSION >= 0x050400
{
- foreach (const QString &line, d.split(QLatin1Char('\n')))
+ for (const QString &line : d.split(QLatin1Char('\n')))
qDebug().noquote() << line;
}
#else
diff --git a/tests/manual/diaglib/qwindowdump.cpp b/tests/manual/diaglib/qwindowdump.cpp
index 381b683359..83e29fc183 100644
--- a/tests/manual/diaglib/qwindowdump.cpp
+++ b/tests/manual/diaglib/qwindowdump.cpp
@@ -62,7 +62,7 @@ void formatObject(QTextStream &str, const QObject *o)
void formatRect(QTextStream &str, const QRect &geom)
{
str << geom.width() << 'x' << geom.height()
- << forcesign << geom.x() << geom.y() << noforcesign;
+ << Qt::forcesign << geom.x() << geom.y() << Qt::noforcesign;
}
#define debugType(s, type, typeConstant) \
@@ -75,7 +75,7 @@ if (flags & flagConstant) \
void formatWindowFlags(QTextStream &str, Qt::WindowFlags flags)
{
- str << showbase << hex << unsigned(flags) << dec << noshowbase;
+ str << Qt::showbase << Qt::hex << unsigned(flags) << Qt::dec << Qt::noshowbase;
const Qt::WindowFlags windowType = flags & Qt::WindowType_Mask;
debugFlag(str, flags, Qt::Window)
debugType(str, windowType, Qt::Dialog)
@@ -123,7 +123,7 @@ void formatWindow(QTextStream &str, const QWindow *w, FormatWindowOptions option
formatObject(str, w);
str << ' ' << (w->isVisible() ? "[visible] " : "[hidden] ");
if (const WId nativeWinId = pw ? pw->winId() : WId(0))
- str << "[native: " << hex << showbase << nativeWinId << dec << noshowbase << "] ";
+ str << "[native: " << Qt::hex << Qt::showbase << nativeWinId << Qt::dec << Qt::noshowbase << "] ";
if (w->isTopLevel())
str << "[top] ";
if (w->isExposed())
@@ -162,7 +162,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);
}
@@ -173,7 +173,7 @@ 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;
diff --git a/tests/manual/diaglib/textdump.cpp b/tests/manual/diaglib/textdump.cpp
index 383ec4edb0..61fb494785 100644
--- a/tests/manual/diaglib/textdump.cpp
+++ b/tests/manual/diaglib/textdump.cpp
@@ -408,8 +408,8 @@ struct FormattingContext
static void formatCharacter(QTextStream &str, const QChar &qc, FormattingContext &context)
{
const ushort unicode = qc.unicode();
- str << "U+" << qSetFieldWidth(4) << qSetPadChar('0') << uppercasedigits << hex << unicode
- << dec << qSetFieldWidth(0) << ' ';
+ str << "U+" << qSetFieldWidth(4) << qSetPadChar('0') << Qt::uppercasedigits
+ << Qt::hex << unicode << Qt::dec << qSetFieldWidth(0) << ' ';
const EnumLookup *specialChar = enumLookup(unicode, specialCharactersEnumLookup, sizeof(specialCharactersEnumLookup) / sizeof(EnumLookup));
if (specialChar)
@@ -477,7 +477,7 @@ QString dumpTextAsCode(const QString &text)
{
QString result;
QTextStream str(&result);
- str << " QString result;\n" << hex << showbase;
+ str << " QString result;\n" << Qt::hex << Qt::showbase;
for (QChar c : text)
str << " result += QChar(" << c.unicode() << ");\n";
str << '\n';