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 --- src/widgets/graphicsview/qgraphicssceneevent.cpp | 17 ++++++----------- src/widgets/graphicsview/qgraphicsview.cpp | 3 +-- 2 files changed, 7 insertions(+), 13 deletions(-) (limited to 'src/widgets/graphicsview') diff --git a/src/widgets/graphicsview/qgraphicssceneevent.cpp b/src/widgets/graphicsview/qgraphicssceneevent.cpp index 5077a39d67..768dd07d4e 100644 --- a/src/widgets/graphicsview/qgraphicssceneevent.cpp +++ b/src/widgets/graphicsview/qgraphicssceneevent.cpp @@ -344,8 +344,7 @@ class QGraphicsSceneMouseEventPrivate : public QGraphicsSceneEventPrivate Q_DECLARE_PUBLIC(QGraphicsSceneMouseEvent) public: inline QGraphicsSceneMouseEventPrivate() - : button(Qt::NoButton), - buttons(0), modifiers(0), source(Qt::MouseEventNotSynthesized), flags(0) + : button(Qt::NoButton), source(Qt::MouseEventNotSynthesized) { } QPointF pos; @@ -691,17 +690,15 @@ class QGraphicsSceneWheelEventPrivate : public QGraphicsSceneEventPrivate { Q_DECLARE_PUBLIC(QGraphicsSceneWheelEvent) public: - inline QGraphicsSceneWheelEventPrivate() - : buttons(0), modifiers(0), delta(0), orientation(Qt::Horizontal) - { } + inline QGraphicsSceneWheelEventPrivate() = default; QPointF pos; QPointF scenePos; QPoint screenPos; Qt::MouseButtons buttons; Qt::KeyboardModifiers modifiers; - int delta; - Qt::Orientation orientation; + int delta = 0; + Qt::Orientation orientation = Qt::Horizontal; }; /*! @@ -872,15 +869,13 @@ class QGraphicsSceneContextMenuEventPrivate : public QGraphicsSceneEventPrivate { Q_DECLARE_PUBLIC(QGraphicsSceneContextMenuEvent) public: - inline QGraphicsSceneContextMenuEventPrivate() - : modifiers(0), reason(QGraphicsSceneContextMenuEvent::Other) - { } + inline QGraphicsSceneContextMenuEventPrivate() = default; QPointF pos; QPointF scenePos; QPoint screenPos; Qt::KeyboardModifiers modifiers; - QGraphicsSceneContextMenuEvent::Reason reason; + QGraphicsSceneContextMenuEvent::Reason reason = QGraphicsSceneContextMenuEvent::Other; }; /*! diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index f1ed0f3b4e..4c270b1af2 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -352,14 +352,13 @@ QGraphicsViewPrivate::QGraphicsViewPrivate() alignment(Qt::AlignCenter), transformationAnchor(QGraphicsView::AnchorViewCenter), resizeAnchor(QGraphicsView::NoAnchor), viewportUpdateMode(QGraphicsView::MinimalViewportUpdate), - optimizationFlags(0), scene(0), #if QT_CONFIG(rubberband) rubberBanding(false), rubberBandSelectionMode(Qt::IntersectsItemShape), rubberBandSelectionOperation(Qt::ReplaceSelection), #endif - handScrollMotions(0), cacheMode(0), + handScrollMotions(0), #ifndef QT_NO_CURSOR hasStoredOriginalCursor(false), #endif -- cgit v1.2.3