Fix compile errors related to missing Qt:: namespace

Change-Id: I092a26ef38b08c52d84adb027a1b1bdee8cc7f6b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
(cherry picked from commit ce187c4f0e57d5053583613aeedbc89024bae240)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Leander Beernaert 2019-11-11 14:03:37 +01:00
parent 04e86bab13
commit 70a218b90b
12 changed files with 68 additions and 54 deletions

View File

@ -68,8 +68,8 @@ QDebug operator<<(QDebug debug, const QStyleOption *option)
} else { } else {
debug << "QStyleOption("; debug << "QStyleOption(";
} }
debug << "rect=" << option->rect.width() << 'x' << option->rect.height() debug << "rect=" << option->rect.width() << 'x' << option->rect.height() << Qt::forcesign
<< forcesign << option->rect.x() << option->rect.y() << noforcesign; << option->rect.x() << option->rect.y() << Qt::noforcesign;
if (option->state != QStyle::State_None) if (option->state != QStyle::State_None)
debug << ", state=" << option->state; debug << ", state=" << option->state;
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000

View File

@ -86,14 +86,16 @@ static void dumpWidgetRecursion(QTextStream &str, const QWidget *w,
formatWidgetClass(str, w); formatWidgetClass(str, w);
str << ' ' << (w->isVisible() ? "[visible] " : "[hidden] "); str << ' ' << (w->isVisible() ? "[visible] " : "[hidden] ");
if (const WId nativeWinId = w->internalWinId()) 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()) if (w->isWindow())
str << "[top] "; str << "[top] ";
str << (w->testAttribute(Qt::WA_Mapped) ? "[mapped] " : "[not mapped] "); str << (w->testAttribute(Qt::WA_Mapped) ? "[mapped] " : "[not mapped] ");
if (w->testAttribute(Qt::WA_DontCreateNativeAncestors)) if (w->testAttribute(Qt::WA_DontCreateNativeAncestors))
str << "[NoNativeAncestors] "; str << "[NoNativeAncestors] ";
if (const int states = w->windowState()) 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()); formatRect(str, w->geometry());
if (w->isWindow()) { if (w->isWindow()) {
str << ' ' << w->logicalDpiX() << "DPI"; str << ' ' << w->logicalDpiX() << "DPI";

View File

@ -61,8 +61,8 @@ void formatObject(QTextStream &str, const QObject *o)
void formatRect(QTextStream &str, const QRect &geom) void formatRect(QTextStream &str, const QRect &geom)
{ {
str << geom.width() << 'x' << geom.height() str << geom.width() << 'x' << geom.height() << Qt::forcesign << geom.x() << geom.y()
<< forcesign << geom.x() << geom.y() << noforcesign; << Qt::noforcesign;
} }
#define debugType(s, type, typeConstant) \ #define debugType(s, type, typeConstant) \
@ -75,7 +75,7 @@ if (flags & flagConstant) \
void formatWindowFlags(QTextStream &str, Qt::WindowFlags flags) 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; const Qt::WindowFlags windowType = flags & Qt::WindowType_Mask;
debugFlag(str, flags, Qt::Window) debugFlag(str, flags, Qt::Window)
debugType(str, windowType, Qt::Dialog) debugType(str, windowType, Qt::Dialog)
@ -123,7 +123,8 @@ void formatWindow(QTextStream &str, const QWindow *w, FormatWindowOptions option
formatObject(str, w); formatObject(str, w);
str << ' ' << (w->isVisible() ? "[visible] " : "[hidden] "); str << ' ' << (w->isVisible() ? "[visible] " : "[hidden] ");
if (const WId nativeWinId = pw ? pw->winId() : WId(0)) 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()) if (w->isTopLevel())
str << "[top] "; str << "[top] ";
if (w->isExposed()) if (w->isExposed())

View File

@ -408,8 +408,8 @@ struct FormattingContext
static void formatCharacter(QTextStream &str, const QChar &qc, FormattingContext &context) static void formatCharacter(QTextStream &str, const QChar &qc, FormattingContext &context)
{ {
const ushort unicode = qc.unicode(); const ushort unicode = qc.unicode();
str << "U+" << qSetFieldWidth(4) << qSetPadChar('0') << uppercasedigits << hex << unicode str << "U+" << qSetFieldWidth(4) << qSetPadChar('0') << Qt::uppercasedigits << Qt::hex
<< dec << qSetFieldWidth(0) << ' '; << unicode << Qt::dec << qSetFieldWidth(0) << ' ';
const EnumLookup *specialChar = enumLookup(unicode, specialCharactersEnumLookup, sizeof(specialCharactersEnumLookup) / sizeof(EnumLookup)); const EnumLookup *specialChar = enumLookup(unicode, specialCharactersEnumLookup, sizeof(specialCharactersEnumLookup) / sizeof(EnumLookup));
if (specialChar) if (specialChar)
@ -477,7 +477,7 @@ QString dumpTextAsCode(const QString &text)
{ {
QString result; QString result;
QTextStream str(&result); QTextStream str(&result);
str << " QString result;\n" << hex << showbase; str << " QString result;\n" << Qt::hex << Qt::showbase;
for (QChar c : text) for (QChar c : text)
str << " result += QChar(" << c.unicode() << ");\n"; str << " result += QChar(" << c.unicode() << ");\n";
str << '\n'; str << '\n';

View File

@ -190,7 +190,8 @@ QTextStream &operator<<(QTextStream &s, const QSizeF &size)
QTextStream &operator<<(QTextStream &s, const QRectF &rect) QTextStream &operator<<(QTextStream &s, const QRectF &rect)
{ {
s << rect.width() << 'x' << rect.height() << forcesign << rect.x() << rect.y() << noforcesign; s << rect.width() << 'x' << rect.height() << Qt::forcesign << rect.x() << rect.y()
<< Qt::noforcesign;
return s; return s;
} }

View File

@ -63,7 +63,7 @@
static QTextStream &operator<<(QTextStream &str, const QRect &r) static QTextStream &operator<<(QTextStream &str, const QRect &r)
{ {
str << r.width() << 'x' << r.height() << forcesign << r.x() << r.y() << noforcesign; str << r.width() << 'x' << r.height() << Qt::forcesign << r.x() << r.y() << Qt::noforcesign;
return str; return str;
} }

View File

@ -58,7 +58,7 @@ void tst_qhttpnetworkconnection::bigRemoteFile()
QVERIFY(!QTestEventLoop::instance().timeout()); QVERIFY(!QTestEventLoop::instance().timeout());
size = reply->size(); size = reply->size();
delete reply; delete reply;
qDebug() << "Finished!" << endl; qDebug() << "Finished!" << Qt::endl;
qDebug() << "Time:" << t.elapsed() << "msec"; qDebug() << "Time:" << t.elapsed() << "msec";
qDebug() << "Bytes:" << size; qDebug() << "Bytes:" << size;
qDebug() << "Speed:" << (size / qreal(1024)) / (t.elapsed() / qreal(1000)) << "KB/sec"; qDebug() << "Speed:" << (size / qreal(1024)) / (t.elapsed() / qreal(1000)) << "KB/sec";

View File

@ -39,33 +39,41 @@
void printShortUsage() void printShortUsage()
{ {
qDebug() << QCoreApplication::applicationName() << " [options] [list of urls]" << endl qDebug() << QCoreApplication::applicationName() << " [options] [list of urls]" << Qt::endl
<< "Get one or more urls using QNetworkAccessManager" << endl << "Get one or more urls using QNetworkAccessManager" << Qt::endl
<< "--help to display detailed usage" << endl; << "--help to display detailed usage" << Qt::endl;
} }
void printUsage() void printUsage()
{ {
qDebug() << QCoreApplication::applicationName() << " [options] [list of urls]" << endl qDebug() << QCoreApplication::applicationName() << " [options] [list of urls]" << Qt::endl
<< "Get one or more urls using QNetworkAccessManager" << endl << "Get one or more urls using QNetworkAccessManager" << Qt::endl
<< "Options:" << "Options:"
<< "--help This message" << endl << "--help This message" << Qt::endl
<< "--user=<username> Set username to use for authentication" << endl << "--user=<username> Set username to use for authentication"
<< "--password=<password> Set password to use for authentication" << endl << Qt::endl
<< "--proxy-user=<username> Set username to use for proxy authentication" << endl << "--password=<password> Set password to use for authentication"
<< "--proxy-password=<password> Set password to use for proxy authentication" << endl << Qt::endl
<< "--proxy=on Use system proxy (default)" << endl << "--proxy-user=<username> Set username to use for proxy authentication"
<< "--proxy=off Don't use system proxy" << endl << Qt::endl
<< "--proxy=<host:port>[,type] Use specified proxy" << endl << "--proxy-password=<password> Set password to use for proxy authentication"
<< " ,http HTTP proxy (default)" << endl << Qt::endl
<< " ,socks SOCKS5 proxy" << endl << "--proxy=on Use system proxy (default)" << Qt::endl
<< " ,ftp FTP proxy" << endl << "--proxy=off Don't use system proxy" << Qt::endl
<< " ,httpcaching HTTP caching proxy (no CONNECT method)" << endl << "--proxy=<host:port>[,type] Use specified proxy" << Qt::endl
<< "--headers=filename Set request headers from file contents" << endl << " ,http HTTP proxy (default)" << Qt::endl
<< "--post=filename upload the file to the next url using HTTP POST" << endl << " ,socks SOCKS5 proxy" << Qt::endl
<< "--put=filename upload the file to the next url using HTTP PUT" << endl << " ,ftp FTP proxy" << Qt::endl
<< "--content-type=<MIME> set content-type header for upload" << endl << " ,httpcaching HTTP caching proxy (no CONNECT method)"
<< "--serial don't run requests in parallel" << endl; << Qt::endl
<< "--headers=filename Set request headers from file contents"
<< Qt::endl
<< "--post=filename upload the file to the next url using HTTP POST"
<< Qt::endl
<< "--put=filename upload the file to the next url using HTTP PUT"
<< Qt::endl
<< "--content-type=<MIME> set content-type header for upload" << Qt::endl
<< "--serial don't run requests in parallel" << Qt::endl;
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])

View File

@ -192,15 +192,15 @@ static inline QString msgScreenChange(const QWidget *w, const QScreen *oldScreen
if (!newScreen) { if (!newScreen) {
result = QLatin1String("Screen changed --> null"); result = QLatin1String("Screen changed --> null");
} else if (!oldScreen) { } else if (!oldScreen) {
QTextStream(&result) << "Screen changed null --> \"" QTextStream(&result) << "Screen changed null --> \"" << newScreen->name() << "\" at "
<< newScreen->name() << "\" at " << pos.x() << ',' << pos.y() << " geometry: " << pos.x() << ',' << pos.y() << " geometry: " << geometry.width()
<< geometry.width() << 'x' << geometry.height() << forcesign << geometry.x() << 'x' << geometry.height() << Qt::forcesign << geometry.x()
<< geometry.y() << '.'; << geometry.y() << '.';
} else { } else {
QTextStream(&result) << "Screen changed \"" << oldScreen->name() << "\" --> \"" QTextStream(&result) << "Screen changed \"" << oldScreen->name() << "\" --> \""
<< newScreen->name() << "\" at " << pos.x() << ',' << pos.y() << " geometry: " << newScreen->name() << "\" at " << pos.x() << ',' << pos.y()
<< geometry.width() << 'x' << geometry.height() << forcesign << geometry.x() << " geometry: " << geometry.width() << 'x' << geometry.height()
<< geometry.y() << '.'; << Qt::forcesign << geometry.x() << geometry.y() << '.';
} }
return result; return result;
} }

View File

@ -37,13 +37,13 @@ int main(int argc, char **argv)
if (argc < 3) { if (argc < 3) {
QTextStream out(stdout); QTextStream out(stdout);
out << "Usage: " << argv[0] << " host port [options]" << endl; out << "Usage: " << argv[0] << " host port [options]" << Qt::endl;
out << "The options can be one or more of the following:" << endl; out << "The options can be one or more of the following:" << Qt::endl;
out << "enable_empty_fragments" << endl; out << "enable_empty_fragments" << Qt::endl;
out << "disable_session_tickets" << endl; out << "disable_session_tickets" << Qt::endl;
out << "disable_compression" << endl; out << "disable_compression" << Qt::endl;
out << "disable_sni" << endl; out << "disable_sni" << Qt::endl;
out << "enable_unsafe_reneg" << endl; out << "enable_unsafe_reneg" << Qt::endl;
return 1; return 1;
} }

View File

@ -526,7 +526,7 @@ void MainWindow::updateScreenLabel()
const QRect geometry = screen->geometry(); const QRect geometry = screen->geometry();
const qreal dpr = screen->devicePixelRatio(); const qreal dpr = screen->devicePixelRatio();
str << '"' << screen->name() << "\" " << geometry.width() << 'x' << geometry.height() str << '"' << screen->name() << "\" " << geometry.width() << 'x' << geometry.height()
<< forcesign << geometry.x() << geometry.y() << noforcesign; << Qt::forcesign << geometry.x() << geometry.y() << Qt::noforcesign;
if (!qFuzzyCompare(dpr, qreal(1))) if (!qFuzzyCompare(dpr, qreal(1)))
str << ", dpr=" << dpr; str << ", dpr=" << dpr;
m_screenLabel->setText(text); m_screenLabel->setText(text);

View File

@ -48,7 +48,8 @@ void PreviewWindow::paintEvent(QPaintEvent *event)
static void formatWindowFlags(QTextStream &str, Qt::WindowFlags flags) static void formatWindowFlags(QTextStream &str, Qt::WindowFlags flags)
{ {
str << "Window flags: " << hex << showbase << unsigned(flags) << noshowbase << dec << ' '; str << "Window flags: " << Qt::hex << Qt::showbase << unsigned(flags) << Qt::noshowbase
<< Qt::dec << ' ';
switch (flags & Qt::WindowType_Mask) { switch (flags & Qt::WindowType_Mask) {
case Qt::Window: case Qt::Window:
str << "Qt::Window"; str << "Qt::Window";
@ -125,7 +126,8 @@ static void formatWindowFlags(QTextStream &str, Qt::WindowFlags flags)
static void formatWindowStates(QTextStream &str, Qt::WindowStates states) static void formatWindowStates(QTextStream &str, Qt::WindowStates states)
{ {
str << "Window states: " << hex << showbase << unsigned(states) << noshowbase << dec << ' '; str << "Window states: " << Qt::hex << Qt::showbase << unsigned(states) << Qt::noshowbase
<< Qt::dec << ' ';
if (states & Qt::WindowActive) { if (states & Qt::WindowActive) {
str << "Qt::WindowActive "; str << "Qt::WindowActive ";
states &= ~Qt::WindowActive; states &= ~Qt::WindowActive;
@ -150,7 +152,7 @@ static void formatWindowStates(QTextStream &str, Qt::WindowStates states)
QTextStream &operator<<(QTextStream &str, const QRect &r) QTextStream &operator<<(QTextStream &str, const QRect &r)
{ {
str << r.width() << 'x' << r.height() << forcesign << r.x() << r.y() << noforcesign; str << r.width() << 'x' << r.height() << Qt::forcesign << r.x() << r.y() << Qt::noforcesign;
return str; return str;
} }