diff --git a/tests/manual/diaglib/debugproxystyle.h b/tests/manual/diaglib/debugproxystyle.h index 01e1e6b6d1..51bf79374e 100644 --- a/tests/manual/diaglib/debugproxystyle.h +++ b/tests/manual/diaglib/debugproxystyle.h @@ -39,19 +39,19 @@ class DebugProxyStyle : public QProxyStyle { public: explicit DebugProxyStyle(QStyle *style); - void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const; - void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const; - void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = 0) const; - void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const; - QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const; - QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const; - QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const; - QRect itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const; - QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const; - int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const; - int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const; - QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget = 0) const; - QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const; + void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const override; + void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const override; + void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = nullptr) const override; + void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const override; + QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const override; + QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const override; + QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const override; + QRect itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const override; + QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const override; + int styleHint(StyleHint hint, const QStyleOption *option = nullptr, const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const override; + int pixelMetric(PixelMetric metric, const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const override; + QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget = nullptr) const override; + QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const override; }; } // namespace QtDiag diff --git a/tests/manual/diaglib/eventfilter.cpp b/tests/manual/diaglib/eventfilter.cpp index 39898f0781..b99d4099e3 100644 --- a/tests/manual/diaglib/eventfilter.cpp +++ b/tests/manual/diaglib/eventfilter.cpp @@ -197,7 +197,7 @@ static void formatApplicationState(QDebug debug) static void formatMouseState(QObject *o, QDebug debug) { if (o->isWidgetType()) { - const QWidget *w = static_cast(o); + auto w = static_cast(o); if (QWidget::mouseGrabber() == w) debug << " [grabbed]"; if (w->hasMouseTracking()) diff --git a/tests/manual/diaglib/eventfilter.h b/tests/manual/diaglib/eventfilter.h index 1f57fbeb8b..a8740bb4e9 100644 --- a/tests/manual/diaglib/eventfilter.h +++ b/tests/manual/diaglib/eventfilter.h @@ -68,10 +68,10 @@ public: }; Q_DECLARE_FLAGS(ObjectTypes, ObjectType) - explicit EventFilter(EventCategories eventCategories, QObject *p = 0); - explicit EventFilter(QObject *p = 0); + explicit EventFilter(EventCategories eventCategories, QObject *p = nullptr); + explicit EventFilter(QObject *p = nullptr); - bool eventFilter(QObject *, QEvent *); + bool eventFilter(QObject *, QEvent *) override; ObjectTypes objectTypes() const { return m_objectTypes; } void setObjectTypes(ObjectTypes objectTypes) { m_objectTypes = objectTypes; } diff --git a/tests/manual/diaglib/logwidget.cpp b/tests/manual/diaglib/logwidget.cpp index 35fabd6e2e..18a82d819e 100644 --- a/tests/manual/diaglib/logwidget.cpp +++ b/tests/manual/diaglib/logwidget.cpp @@ -40,7 +40,7 @@ #include -LogWidget *LogWidget::m_instance = 0; +LogWidget *LogWidget::m_instance = nullptr; bool LogWidget::m_lineNumberingEnabled = true; bool LogWidget::m_showMessageType = true; int LogWidget::m_indent = 0; @@ -54,7 +54,7 @@ LogWidget::LogWidget(QWidget *parent) LogWidget::~LogWidget() { - LogWidget::m_instance = 0; + LogWidget::m_instance = nullptr; } QString LogWidget::startupMessage() diff --git a/tests/manual/diaglib/logwidget.h b/tests/manual/diaglib/logwidget.h index 55324e3100..b1ce43f231 100644 --- a/tests/manual/diaglib/logwidget.h +++ b/tests/manual/diaglib/logwidget.h @@ -46,7 +46,7 @@ class LogWidget : public QPlainTextEdit { Q_OBJECT public: - explicit LogWidget(QWidget *parent = 0); + explicit LogWidget(QWidget *parent = nullptr); ~LogWidget(); static LogWidget *instance() { return m_instance; } diff --git a/tests/manual/diaglib/qwidgetdump.cpp b/tests/manual/diaglib/qwidgetdump.cpp index 6c1e7d8f79..5a2966021b 100644 --- a/tests/manual/diaglib/qwidgetdump.cpp +++ b/tests/manual/diaglib/qwidgetdump.cpp @@ -59,8 +59,8 @@ static const char *qtWidgetClasses[] = { static bool isQtWidget(const char *className) { - for (size_t i = 0, count = sizeof(qtWidgetClasses) / sizeof(qtWidgetClasses[0]); i < count; ++i) { - if (!qstrcmp(className, qtWidgetClasses[i])) + for (auto qtWidgetClass : qtWidgetClasses) { + if (qstrcmp(className, qtWidgetClass) == 0) return true; } return false; diff --git a/tests/manual/diaglib/qwidgetdump.h b/tests/manual/diaglib/qwidgetdump.h index f3eb1fda8d..c9b2db72dd 100644 --- a/tests/manual/diaglib/qwidgetdump.h +++ b/tests/manual/diaglib/qwidgetdump.h @@ -35,7 +35,7 @@ QT_FORWARD_DECLARE_CLASS(QWidget) namespace QtDiag { -void dumpAllWidgets(FormatWindowOptions options = 0, const QWidget *root = 0); +void dumpAllWidgets(FormatWindowOptions options = {}, const QWidget *root = nullptr); } // namespace QtDiag diff --git a/tests/manual/diaglib/qwindowdump.cpp b/tests/manual/diaglib/qwindowdump.cpp index 0e613753ef..381b683359 100644 --- a/tests/manual/diaglib/qwindowdump.cpp +++ b/tests/manual/diaglib/qwindowdump.cpp @@ -73,7 +73,7 @@ if ((type & typeConstant) == typeConstant) \ if (flags & flagConstant) \ s << ' ' << #flagConstant; -void formatWindowFlags(QTextStream &str, const Qt::WindowFlags flags) +void formatWindowFlags(QTextStream &str, Qt::WindowFlags flags) { str << showbase << hex << unsigned(flags) << dec << noshowbase; const Qt::WindowFlags windowType = flags & Qt::WindowType_Mask; @@ -158,7 +158,7 @@ void formatWindow(QTextStream &str, const QWindow *w, FormatWindowOptions option } static void dumpWindowRecursion(QTextStream &str, const QWindow *w, - FormatWindowOptions options = 0, int depth = 0) + FormatWindowOptions options = {}, int depth = 0) { indentStream(str, 2 * depth); formatWindow(str, w, options); diff --git a/tests/manual/diaglib/qwindowdump.h b/tests/manual/diaglib/qwindowdump.h index 74f976567a..9d7491eab2 100644 --- a/tests/manual/diaglib/qwindowdump.h +++ b/tests/manual/diaglib/qwindowdump.h @@ -49,10 +49,10 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(FormatWindowOptions) void indentStream(QTextStream &s, int indent); void formatObject(QTextStream &str, const QObject *o); void formatRect(QTextStream &str, const QRect &geom); -void formatWindowFlags(QTextStream &str, const Qt::WindowFlags flags); +void formatWindowFlags(QTextStream &str, Qt::WindowFlags flags); -void formatWindow(QTextStream &str, const QWindow *w, FormatWindowOptions options = 0); -void dumpAllWindows(FormatWindowOptions options = 0); +void formatWindow(QTextStream &str, const QWindow *w, FormatWindowOptions options = {}); +void dumpAllWindows(FormatWindowOptions options = {}); } // namespace QtDiag diff --git a/tests/manual/diaglib/textdump.cpp b/tests/manual/diaglib/textdump.cpp index e070a920e7..8bb899783b 100644 --- a/tests/manual/diaglib/textdump.cpp +++ b/tests/manual/diaglib/textdump.cpp @@ -381,7 +381,7 @@ static const EnumLookup *enumLookup(int v, const EnumLookup *array, size_t size) if (p->value == v) return p; } - return 0; + return nullptr; } static const char *enumName(int v, const EnumLookup *array, size_t size) @@ -394,15 +394,12 @@ static const char *enumName(int v, const EnumLookup *array, size_t size) // that change will be output. struct FormattingContext { - FormattingContext() : category(-1), direction(-1), joiningType(-1) - , decompositionTag(-1), script(-1), unicodeVersion(-1) {} - - int category; - int direction; - int joiningType; - int decompositionTag; - int script; - int unicodeVersion; + int category = -1; + int direction = -1; + int joiningType = -1; + int decompositionTag = -1; + int script = -1; + int unicodeVersion = -1; }; static void formatCharacter(QTextStream &str, const QChar &qc, FormattingContext &context) @@ -478,8 +475,8 @@ QString dumpTextAsCode(const QString &text) QString result; QTextStream str(&result); str << " QString result;\n" << hex << showbase; - for (int i = 0; i < text.size(); ++i) - str << " result += QChar(" << text.at(i).unicode() << ");\n"; + for (QChar c : text) + str << " result += QChar(" << c.unicode() << ");\n"; str << '\n'; return result; }