Diaglib: Fix build
Use range-based for and fix deprecation warnings. Change-Id: I54152b2598e9e4a7a3cc9db9b7072bbabcef7fcf Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
parent
46ebd11e66
commit
cc333f5faf
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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';
|
||||
|
Loading…
x
Reference in New Issue
Block a user