From 2c871dfd38d89d6415c2c25d47b4a0e9c8b2ef11 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 22 Nov 2019 15:34:38 +0100 Subject: Avoid initializing QFlags with 0 or nullptr in further cases Amends qtbase/af2daafde72db02454d24b7d691aa6861525ab99. Where applicable, port over to member initialization, thus also fixing nullptr warnings. Change-Id: Iaaf2dbbbcf2952253390b8839fd15a1b17be32c0 Reviewed-by: Allan Sandfeld Jensen --- .../eventdispatchers/qwindowsguieventdispatcher.cpp | 2 +- .../windows/qwindowsfontenginedirectwrite.cpp | 2 +- .../input/evdevmouse/qevdevmousehandler.cpp | 3 +-- .../input/evdevmouse/qevdevmousehandler_p.h | 8 ++++---- .../input/evdevtouch/qevdevtouchhandler.cpp | 15 ++++++--------- 5 files changed, 13 insertions(+), 17 deletions(-) (limited to 'src/platformsupport') diff --git a/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher.cpp b/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher.cpp index a37547f513..20cfb5155e 100644 --- a/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher.cpp +++ b/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher.cpp @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE */ QWindowsGuiEventDispatcher::QWindowsGuiEventDispatcher(QObject *parent) : - QEventDispatcherWin32(parent), m_flags(0) + QEventDispatcherWin32(parent) { setObjectName(QStringLiteral("QWindowsGuiEventDispatcher")); createInternalHwnd(); // QTBUG-40881: Do not delay registering timers, etc. for QtMfc. diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp index e796c18e79..3415002ffc 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp @@ -458,7 +458,7 @@ bool QWindowsFontEngineDirectWrite::stringToCMap(const QChar *str, int len, QGly glyphs->numGlyphs = actualLength; if (!(flags & GlyphIndicesOnly)) - recalcAdvances(glyphs, 0); + recalcAdvances(glyphs, {}); return true; } diff --git a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp index 6a53ad2088..a729eeb851 100644 --- a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp +++ b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp @@ -99,8 +99,7 @@ std::unique_ptr QEvdevMouseHandler::create(const QString &de } QEvdevMouseHandler::QEvdevMouseHandler(const QString &device, int fd, bool abs, bool compression, int jitterLimit) - : m_device(device), m_fd(fd), m_notify(0), m_x(0), m_y(0), m_prevx(0), m_prevy(0), - m_abs(abs), m_compression(compression), m_buttons(0), m_prevInvalid(true) + : m_device(device), m_fd(fd), m_abs(abs), m_compression(compression) { setObjectName(QLatin1String("Evdev Mouse Handler")); diff --git a/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h b/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h index 727f1a02f9..93314e885f 100644 --- a/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h +++ b/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h @@ -84,16 +84,16 @@ private: QString m_device; int m_fd; - QSocketNotifier *m_notify; - int m_x, m_y; - int m_prevx, m_prevy; + QSocketNotifier *m_notify = nullptr; + int m_x = 0, m_y = 0; + int m_prevx = 0, m_prevy = 0; bool m_abs; bool m_compression; Qt::MouseButtons m_buttons; Qt::MouseButton m_button; QEvent::Type m_eventType; int m_jitterLimitSquared; - bool m_prevInvalid; + bool m_prevInvalid = true; int m_hardwareWidth; int m_hardwareHeight; qreal m_hardwareScalerY; diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp index c51db59e1f..78728ef4ce 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp @@ -113,16 +113,13 @@ public: QList m_lastTouchPoints; struct Contact { - int trackingId; - int x; - int y; - int maj; - int pressure; - Qt::TouchPointState state; + int trackingId = -1; + int x = 0; + int y = 0; + int maj = -1; + int pressure = 0; + Qt::TouchPointState state = Qt::TouchPointPressed; QTouchEvent::TouchPoint::InfoFlags flags; - Contact() : trackingId(-1), - x(0), y(0), maj(-1), pressure(0), - state(Qt::TouchPointPressed), flags(0) { } }; QHash m_contacts; // The key is a tracking id for type A, slot number for type B. QHash m_lastContacts; -- cgit v1.2.3