diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-05-05 03:00:08 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2018-05-07 14:18:09 +0200 |
commit | de9c38dd61ce29f549e2b13871e981209a0fed9e (patch) | |
tree | 9c1824fc361d7039d297cbf9a56002cea52f8c23 | |
parent | 3b5143bb67cdaaff6b0eabedff1034e4add7ec87 (diff) | |
parent | bf39c3ce5524d151532d89efef40ff1a8e25f4c0 (diff) |
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
src/quicktemplates2/qquickabstractbutton_p_p.h
src/quicktemplates2/qquickcombobox.cpp
src/quicktemplates2/qquickcontainer.cpp
src/quicktemplates2/qquickcontrol.cpp
src/quicktemplates2/qquickcontrol_p_p.h
src/quicktemplates2/qquickdialog_p_p.h
src/quicktemplates2/qquickdialogbuttonbox.cpp
src/quicktemplates2/qquickdialogbuttonbox_p_p.h
src/quicktemplates2/qquickdrawer.cpp
src/quicktemplates2/qquickmenubar.cpp
src/quicktemplates2/qquickmenubar_p_p.h
src/quicktemplates2/qquickpage.cpp
src/quicktemplates2/qquickpage_p_p.h
src/quicktemplates2/qquickpane.cpp
src/quicktemplates2/qquickpane_p_p.h
src/quicktemplates2/qquickpopup.cpp
src/quicktemplates2/qquickpopup_p_p.h
src/quicktemplates2/qquickrangeslider.cpp
src/quicktemplates2/qquickscrollview.cpp
src/quicktemplates2/qquickslider.cpp
src/quicktemplates2/qquickspinbox.cpp
src/quicktemplates2/qquickswipeview.cpp
src/quicktemplates2/qquicktabbar.cpp
src/quicktemplates2/qquicktextarea_p_p.h
src/quicktemplates2/qquicktextfield_p_p.h
src/quicktemplates2/qquicktheme_p.h
Change-Id: I6e2b8fe99e51e3e26c87546aa66af045bc429ec4
122 files changed, 575 insertions, 1314 deletions
diff --git a/src/imports/controls/fusion/qquickfusiondial.cpp b/src/imports/controls/fusion/qquickfusiondial.cpp index 014078e6..182f5c0f 100644 --- a/src/imports/controls/fusion/qquickfusiondial.cpp +++ b/src/imports/controls/fusion/qquickfusiondial.cpp @@ -42,8 +42,7 @@ QT_BEGIN_NAMESPACE QQuickFusionDial::QQuickFusionDial(QQuickItem *parent) - : QQuickPaintedItem(parent), - m_highlight(false) + : QQuickPaintedItem(parent) { } diff --git a/src/imports/controls/fusion/qquickfusiondial_p.h b/src/imports/controls/fusion/qquickfusiondial_p.h index d3216521..740545d8 100644 --- a/src/imports/controls/fusion/qquickfusiondial_p.h +++ b/src/imports/controls/fusion/qquickfusiondial_p.h @@ -71,7 +71,7 @@ public: void paint(QPainter *painter) override; private: - bool m_highlight; + bool m_highlight = false; QPalette m_palette; }; diff --git a/src/imports/controls/imagine/qquickimageselector.cpp b/src/imports/controls/imagine/qquickimageselector.cpp index 1b3e80a9..67d3a24b 100644 --- a/src/imports/controls/imagine/qquickimageselector.cpp +++ b/src/imports/controls/imagine/qquickimageselector.cpp @@ -106,9 +106,7 @@ static QString findFile(const QDir &dir, const QString &baseName, const QStringL QQuickImageSelector::QQuickImageSelector(QObject *parent) : QObject(parent), - m_cache(cacheSize() > 0), - m_complete(false), - m_separator(QLatin1String("-")) + m_cache(cacheSize() > 0) { } diff --git a/src/imports/controls/imagine/qquickimageselector_p.h b/src/imports/controls/imagine/qquickimageselector_p.h index 2bb4e526..d050707d 100644 --- a/src/imports/controls/imagine/qquickimageselector_p.h +++ b/src/imports/controls/imagine/qquickimageselector_p.h @@ -110,12 +110,12 @@ protected: int calculateScore(const QStringList &states) const; private: - bool m_cache; - bool m_complete; + bool m_cache = false; + bool m_complete = false; QUrl m_source; QString m_path; QString m_name; - QString m_separator; + QString m_separator = QLatin1String("-"); QVariantList m_allStates; QStringList m_activeStates; QQmlProperty m_property; diff --git a/src/imports/controls/imagine/qquickimaginestyle.cpp b/src/imports/controls/imagine/qquickimaginestyle.cpp index 7617fbf5..9e1431de 100644 --- a/src/imports/controls/imagine/qquickimaginestyle.cpp +++ b/src/imports/controls/imagine/qquickimaginestyle.cpp @@ -51,7 +51,6 @@ static const QString ensureSlash(const QString &path) QQuickImagineStyle::QQuickImagineStyle(QObject *parent) : QQuickAttachedObject(parent), - m_explicitPath(false), m_path(*GlobalPath()) { init(); diff --git a/src/imports/controls/imagine/qquickimaginestyle_p.h b/src/imports/controls/imagine/qquickimaginestyle_p.h index 88b92c00..20a4baf0 100644 --- a/src/imports/controls/imagine/qquickimaginestyle_p.h +++ b/src/imports/controls/imagine/qquickimaginestyle_p.h @@ -82,7 +82,7 @@ protected: private: void init(); - bool m_explicitPath; + bool m_explicitPath = false; QString m_path; }; diff --git a/src/imports/controls/material/qquickmaterialbusyindicator.cpp b/src/imports/controls/material/qquickmaterialbusyindicator.cpp index 0a4191be..c18a4005 100644 --- a/src/imports/controls/material/qquickmaterialbusyindicator.cpp +++ b/src/imports/controls/material/qquickmaterialbusyindicator.cpp @@ -77,21 +77,16 @@ protected: void updateCurrentTime(int time) override; private: - int m_lastStartAngle; - int m_lastEndAngle; - qreal m_width; - qreal m_height; - qreal m_devicePixelRatio; + int m_lastStartAngle = 0; + int m_lastEndAngle = 0; + qreal m_width = 0; + qreal m_height = 0; + qreal m_devicePixelRatio = 1; QColor m_color; }; QQuickMaterialBusyIndicatorNode::QQuickMaterialBusyIndicatorNode(QQuickMaterialBusyIndicator *item) - : QQuickAnimatedNode(item), - m_lastStartAngle(0), - m_lastEndAngle(0), - m_width(0), - m_height(0), - m_devicePixelRatio(1) + : QQuickAnimatedNode(item) { setLoopCount(Infinite); setCurrentTime(item->elapsed()); @@ -179,7 +174,7 @@ void QQuickMaterialBusyIndicatorNode::sync(QQuickItem *item) } QQuickMaterialBusyIndicator::QQuickMaterialBusyIndicator(QQuickItem *parent) : - QQuickItem(parent), m_elapsed(0), m_color(Qt::black) + QQuickItem(parent) { setFlag(ItemHasContents); } diff --git a/src/imports/controls/material/qquickmaterialbusyindicator_p.h b/src/imports/controls/material/qquickmaterialbusyindicator_p.h index 6c6d2445..d29427c1 100644 --- a/src/imports/controls/material/qquickmaterialbusyindicator_p.h +++ b/src/imports/controls/material/qquickmaterialbusyindicator_p.h @@ -75,8 +75,8 @@ protected: QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override; private: - int m_elapsed; - QColor m_color; + int m_elapsed = 0; + QColor m_color = Qt::black; }; QT_END_NAMESPACE diff --git a/src/imports/controls/material/qquickmaterialprogressbar.cpp b/src/imports/controls/material/qquickmaterialprogressbar.cpp index c1d36d3b..4635c57b 100644 --- a/src/imports/controls/material/qquickmaterialprogressbar.cpp +++ b/src/imports/controls/material/qquickmaterialprogressbar.cpp @@ -62,14 +62,12 @@ public: private: void moveNode(QSGTransformNode *node, const QRectF &geometry, qreal progress); - bool m_indeterminate; - QEasingCurve m_easing; + bool m_indeterminate = false; + QEasingCurve m_easing = QEasingCurve::OutCubic; }; QQuickMaterialProgressBarNode::QQuickMaterialProgressBarNode(QQuickMaterialProgressBar *item) - : QQuickAnimatedNode(item), - m_indeterminate(false), - m_easing(QEasingCurve::OutCubic) + : QQuickAnimatedNode(item) { setLoopCount(Infinite); setDuration(TotalDuration); @@ -176,7 +174,7 @@ void QQuickMaterialProgressBarNode::moveNode(QSGTransformNode *transformNode, co } QQuickMaterialProgressBar::QQuickMaterialProgressBar(QQuickItem *parent) - : QQuickItem(parent), m_color(Qt::black), m_progress(0.0), m_indeterminate(false) + : QQuickItem(parent) { setFlag(ItemHasContents); } diff --git a/src/imports/controls/material/qquickmaterialprogressbar_p.h b/src/imports/controls/material/qquickmaterialprogressbar_p.h index 981d9bfb..680f36a4 100644 --- a/src/imports/controls/material/qquickmaterialprogressbar_p.h +++ b/src/imports/controls/material/qquickmaterialprogressbar_p.h @@ -77,9 +77,9 @@ protected: QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override; private: - QColor m_color; - qreal m_progress; - bool m_indeterminate; + QColor m_color = Qt::black; + qreal m_progress = 0.0; + bool m_indeterminate = false; }; QT_END_NAMESPACE diff --git a/src/imports/controls/material/qquickmaterialripple.cpp b/src/imports/controls/material/qquickmaterialripple.cpp index 1c3b3f12..e6287ff9 100644 --- a/src/imports/controls/material/qquickmaterialripple.cpp +++ b/src/imports/controls/material/qquickmaterialripple.cpp @@ -64,20 +64,16 @@ public: void sync(QQuickItem *item) override; private: - qreal m_from; - qreal m_to; - qreal m_value; - WavePhase m_phase; + qreal m_from = 0; + qreal m_to = 0; + qreal m_value = 0; + WavePhase m_phase = WaveEnter; QPointF m_anchor; QRectF m_bounds; }; QQuickMaterialRippleWaveNode::QQuickMaterialRippleWaveNode(QQuickMaterialRipple *ripple) - : QQuickAnimatedNode(ripple), - m_from(0), - m_to(0), - m_value(0), - m_phase(WaveEnter) + : QQuickAnimatedNode(ripple) { start(qRound(1000.0 * qSqrt(ripple->diameter() / 2.0 / WAVE_TOUCH_DOWN_ACCELERATION))); @@ -156,12 +152,11 @@ public: void sync(QQuickItem *item) override; private: - bool m_active; + bool m_active = false; }; QQuickMaterialRippleBackgroundNode::QQuickMaterialRippleBackgroundNode(QQuickMaterialRipple *ripple) - : QQuickAnimatedNode(ripple), - m_active(false) + : QQuickAnimatedNode(ripple) { setDuration(OPACITY_ENTER_DURATION_FAST); @@ -221,14 +216,7 @@ void QQuickMaterialRippleBackgroundNode::sync(QQuickItem *item) } QQuickMaterialRipple::QQuickMaterialRipple(QQuickItem *parent) - : QQuickItem(parent), - m_active(false), - m_pressed(false), - m_waves(0), - m_enterDelay(0), - m_trigger(Press), - m_clipRadius(0.0), - m_anchor(nullptr) + : QQuickItem(parent) { setFlag(ItemHasContents); } diff --git a/src/imports/controls/material/qquickmaterialripple_p.h b/src/imports/controls/material/qquickmaterialripple_p.h index 712697da..8a80113b 100644 --- a/src/imports/controls/material/qquickmaterialripple_p.h +++ b/src/imports/controls/material/qquickmaterialripple_p.h @@ -101,14 +101,14 @@ protected: void exitWave(); private: - bool m_active; - bool m_pressed; - int m_waves; - int m_enterDelay; - Trigger m_trigger; - qreal m_clipRadius; + bool m_active = false; + bool m_pressed = false; + int m_waves = 0; + int m_enterDelay = 0; + Trigger m_trigger = Press; + qreal m_clipRadius = 0.0; QColor m_color; - QQuickItem *m_anchor; + QQuickItem *m_anchor = nullptr; }; QT_END_NAMESPACE diff --git a/src/imports/controls/material/qquickmaterialstyle.cpp b/src/imports/controls/material/qquickmaterialstyle.cpp index 5cbd87ea..77a65927 100644 --- a/src/imports/controls/material/qquickmaterialstyle.cpp +++ b/src/imports/controls/material/qquickmaterialstyle.cpp @@ -431,11 +431,6 @@ static QQuickMaterialStyle::Theme effectiveTheme(QQuickMaterialStyle::Theme them } QQuickMaterialStyle::QQuickMaterialStyle(QObject *parent) : QQuickAttachedObject(parent), - m_explicitTheme(false), - m_explicitPrimary(false), - m_explicitAccent(false), - m_explicitForeground(false), - m_explicitBackground(false), m_customPrimary(globalPrimaryCustom), m_customAccent(globalAccentCustom), m_customForeground(globalForegroundCustom), @@ -446,8 +441,7 @@ QQuickMaterialStyle::QQuickMaterialStyle(QObject *parent) : QQuickAttachedObject m_primary(globalPrimary), m_accent(globalAccent), m_foreground(globalForeground), - m_background(globalBackground), - m_elevation(0) + m_background(globalBackground) { QQuickAttachedObject::init(); } diff --git a/src/imports/controls/material/qquickmaterialstyle_p.h b/src/imports/controls/material/qquickmaterialstyle_p.h index 0f209a6f..4b0f7b31 100644 --- a/src/imports/controls/material/qquickmaterialstyle_p.h +++ b/src/imports/controls/material/qquickmaterialstyle_p.h @@ -279,31 +279,31 @@ private: // These reflect whether a color value was explicitly set on the specific // item that this attached style object represents. - bool m_explicitTheme; - bool m_explicitPrimary; - bool m_explicitAccent; - bool m_explicitForeground; - bool m_explicitBackground; + bool m_explicitTheme = false; + bool m_explicitPrimary = false; + bool m_explicitAccent = false; + bool m_explicitForeground = false; + bool m_explicitBackground = false; // These reflect whether the color value that was either inherited or // explicitly set is in the form that QColor expects, rather than one of // our pre-defined color enum values. - bool m_customPrimary; - bool m_customAccent; - bool m_customForeground; - bool m_customBackground; + bool m_customPrimary = false; + bool m_customAccent = false; + bool m_customForeground = false; + bool m_customBackground = false; // These will be true when this item has an explicit or inherited foreground/background // color, or these colors were declared globally via settings (e.g. conf or env vars). // Some color properties of the style will return different values depending on whether // or not these are set. - bool m_hasForeground; - bool m_hasBackground; + bool m_hasForeground = false; + bool m_hasBackground = false; // The actual values for this item, whether explicit, inherited or globally set. - Theme m_theme; - uint m_primary; - uint m_accent; - uint m_foreground; - uint m_background; - int m_elevation; + Theme m_theme = Light; + uint m_primary = 0; + uint m_accent = 0; + uint m_foreground = 0; + uint m_background = 0; + int m_elevation = 0; }; QT_END_NAMESPACE diff --git a/src/imports/controls/qquickdefaultbusyindicator.cpp b/src/imports/controls/qquickdefaultbusyindicator.cpp index c02d8128..98a3cae3 100644 --- a/src/imports/controls/qquickdefaultbusyindicator.cpp +++ b/src/imports/controls/qquickdefaultbusyindicator.cpp @@ -138,7 +138,7 @@ void QQuickDefaultBusyIndicatorNode::sync(QQuickItem *item) } QQuickDefaultBusyIndicator::QQuickDefaultBusyIndicator(QQuickItem *parent) : - QQuickItem(parent), m_elapsed(0) + QQuickItem(parent) { setFlag(ItemHasContents); } diff --git a/src/imports/controls/qquickdefaultbusyindicator_p.h b/src/imports/controls/qquickdefaultbusyindicator_p.h index 1beeb0c9..eedaf09a 100644 --- a/src/imports/controls/qquickdefaultbusyindicator_p.h +++ b/src/imports/controls/qquickdefaultbusyindicator_p.h @@ -79,7 +79,7 @@ protected: QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override; private: - int m_elapsed; + int m_elapsed = 0; QColor m_pen; QColor m_fill; }; diff --git a/src/imports/controls/qquickdefaultdial.cpp b/src/imports/controls/qquickdefaultdial.cpp index 845e634d..1653def7 100644 --- a/src/imports/controls/qquickdefaultdial.cpp +++ b/src/imports/controls/qquickdefaultdial.cpp @@ -43,9 +43,7 @@ QT_BEGIN_NAMESPACE QQuickDefaultDial::QQuickDefaultDial(QQuickItem *parent) : - QQuickPaintedItem(parent), - m_progress(0), - m_color(Qt::black) + QQuickPaintedItem(parent) { } diff --git a/src/imports/controls/qquickdefaultdial_p.h b/src/imports/controls/qquickdefaultdial_p.h index 10490610..73e14321 100644 --- a/src/imports/controls/qquickdefaultdial_p.h +++ b/src/imports/controls/qquickdefaultdial_p.h @@ -71,8 +71,8 @@ public: void paint(QPainter *painter) override; private: - qreal m_progress; - QColor m_color; + qreal m_progress = 0; + QColor m_color = Qt::black; }; QT_END_NAMESPACE diff --git a/src/imports/controls/qquickdefaultprogressbar.cpp b/src/imports/controls/qquickdefaultprogressbar.cpp index f5bd1db8..e8657255 100644 --- a/src/imports/controls/qquickdefaultprogressbar.cpp +++ b/src/imports/controls/qquickdefaultprogressbar.cpp @@ -77,13 +77,12 @@ public: void sync(QQuickItem *item) override; private: - bool m_indeterminate; - qreal m_pixelsPerSecond; + bool m_indeterminate = false; + qreal m_pixelsPerSecond = 0; }; QQuickDefaultProgressBarNode::QQuickDefaultProgressBarNode(QQuickDefaultProgressBar *item) : QQuickAnimatedNode(item), - m_indeterminate(false), m_pixelsPerSecond(item->width()) { setLoopCount(Infinite); @@ -209,9 +208,7 @@ void QQuickDefaultProgressBarNode::sync(QQuickItem *item) } QQuickDefaultProgressBar::QQuickDefaultProgressBar(QQuickItem *parent) : - QQuickItem(parent), - m_progress(0), - m_indeterminate(false) + QQuickItem(parent) { setFlag(ItemHasContents); } diff --git a/src/imports/controls/qquickdefaultprogressbar_p.h b/src/imports/controls/qquickdefaultprogressbar_p.h index 91f8056b..241d0b3b 100644 --- a/src/imports/controls/qquickdefaultprogressbar_p.h +++ b/src/imports/controls/qquickdefaultprogressbar_p.h @@ -77,8 +77,8 @@ protected: QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override; private: - qreal m_progress; - bool m_indeterminate; + qreal m_progress = 0; + bool m_indeterminate = false; QColor m_color; }; diff --git a/src/imports/controls/universal/qquickuniversalbusyindicator.cpp b/src/imports/controls/universal/qquickuniversalbusyindicator.cpp index a3d09094..70170296 100644 --- a/src/imports/controls/universal/qquickuniversalbusyindicator.cpp +++ b/src/imports/controls/universal/qquickuniversalbusyindicator.cpp @@ -58,12 +58,12 @@ public: private: struct Phase { - Phase() : duration(0), from(0), to(0), curve(QEasingCurve::Linear) { } + Phase() = default; Phase(int d, qreal f, qreal t, QEasingCurve::Type c) : duration(d), from(f), to(t), curve(c) { } - int duration; - qreal from; - qreal to; - QEasingCurve curve; + int duration = 0; + qreal from = 0; + qreal to = 0; + QEasingCurve curve = QEasingCurve::Linear; }; Phase m_phases[PhaseCount]; @@ -186,7 +186,7 @@ void QQuickUniversalBusyIndicatorNode::sync(QQuickItem *item) } QQuickUniversalBusyIndicator::QQuickUniversalBusyIndicator(QQuickItem *parent) - : QQuickItem(parent), m_count(5), m_elapsed(0), m_color(Qt::black) + : QQuickItem(parent) { setFlag(ItemHasContents); } diff --git a/src/imports/controls/universal/qquickuniversalbusyindicator_p.h b/src/imports/controls/universal/qquickuniversalbusyindicator_p.h index 6b888463..119091b5 100644 --- a/src/imports/controls/universal/qquickuniversalbusyindicator_p.h +++ b/src/imports/controls/universal/qquickuniversalbusyindicator_p.h @@ -75,9 +75,9 @@ protected: QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override; private: - int m_count; - int m_elapsed; - QColor m_color; + int m_count = 5; + int m_elapsed = 0; + QColor m_color = Qt::black; }; QT_END_NAMESPACE diff --git a/src/imports/controls/universal/qquickuniversalprogressbar.cpp b/src/imports/controls/universal/qquickuniversalprogressbar.cpp index 25dfda6f..7d4642c5 100644 --- a/src/imports/controls/universal/qquickuniversalprogressbar.cpp +++ b/src/imports/controls/universal/qquickuniversalprogressbar.cpp @@ -67,21 +67,20 @@ public: private: struct Phase { - Phase() : duration(0), from(0), to(0) { } + Phase() = default; Phase(int d, qreal f, qreal t) : duration(d), from(f), to(t) { } - int duration; - qreal from; - qreal to; + int duration = 0; + qreal from = 0; + qreal to = 0; }; - bool m_indeterminate; + bool m_indeterminate = false; Phase m_borderPhases[PhaseCount]; Phase m_ellipsePhases[PhaseCount]; }; QQuickUniversalProgressBarNode::QQuickUniversalProgressBarNode(QQuickUniversalProgressBar *item) - : QQuickAnimatedNode(item), - m_indeterminate(false) + : QQuickAnimatedNode(item) { setLoopCount(Infinite); setDuration(TotalDuration); @@ -267,7 +266,7 @@ void QQuickUniversalProgressBarNode::sync(QQuickItem *item) } QQuickUniversalProgressBar::QQuickUniversalProgressBar(QQuickItem *parent) - : QQuickItem(parent), m_color(Qt::black), m_progress(0.0), m_indeterminate(false) + : QQuickItem(parent) { setFlag(ItemHasContents); } diff --git a/src/imports/controls/universal/qquickuniversalprogressbar_p.h b/src/imports/controls/universal/qquickuniversalprogressbar_p.h index ef34289c..449f7965 100644 --- a/src/imports/controls/universal/qquickuniversalprogressbar_p.h +++ b/src/imports/controls/universal/qquickuniversalprogressbar_p.h @@ -77,9 +77,9 @@ protected: QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override; private: - QColor m_color; - qreal m_progress; - bool m_indeterminate; + QColor m_color = Qt::black; + qreal m_progress = 0.0; + bool m_indeterminate = false; }; QT_END_NAMESPACE diff --git a/src/imports/controls/universal/qquickuniversalstyle.cpp b/src/imports/controls/universal/qquickuniversalstyle.cpp index dbc409fd..d46752f3 100644 --- a/src/imports/controls/universal/qquickuniversalstyle.cpp +++ b/src/imports/controls/universal/qquickuniversalstyle.cpp @@ -152,7 +152,6 @@ static bool HasGlobalForeground = false; static bool HasGlobalBackground = false; QQuickUniversalStyle::QQuickUniversalStyle(QObject *parent) : QQuickAttachedObject(parent), - m_explicitTheme(false), m_explicitAccent(false), m_explicitForeground(false), m_explicitBackground(false), m_hasForeground(HasGlobalForeground), m_hasBackground(HasGlobalBackground), m_theme(GlobalTheme), m_accent(GlobalAccent), m_foreground(GlobalForeground), m_background(GlobalBackground) { diff --git a/src/imports/controls/universal/qquickuniversalstyle_p.h b/src/imports/controls/universal/qquickuniversalstyle_p.h index eb9f6d83..429621d7 100644 --- a/src/imports/controls/universal/qquickuniversalstyle_p.h +++ b/src/imports/controls/universal/qquickuniversalstyle_p.h @@ -217,21 +217,21 @@ private: // These reflect whether a color value was explicitly set on the specific // item that this attached style object represents. - bool m_explicitTheme; - bool m_explicitAccent; - bool m_explicitForeground; - bool m_explicitBackground; + bool m_explicitTheme = false; + bool m_explicitAccent = false; + bool m_explicitForeground = false; + bool m_explicitBackground = false; // These will be true when this item has an explicit or inherited foreground/background // color, or these colors were declared globally via settings (e.g. conf or env vars). // Some color properties of the style will return different values depending on whether // or not these are set. - bool m_hasForeground; - bool m_hasBackground; + bool m_hasForeground = false; + bool m_hasBackground = false; // The actual values for this item, whether explicit, inherited or globally set. - QQuickUniversalStyle::Theme m_theme; - QRgb m_accent; - QRgb m_foreground; - QRgb m_background; + Theme m_theme = Light; + QRgb m_accent = Qt::blue; + QRgb m_foreground = Qt::black; + QRgb m_background = Qt::white; }; QT_END_NAMESPACE diff --git a/src/quickcontrols2/qquickanimatednode.cpp b/src/quickcontrols2/qquickanimatednode.cpp index 3a18c757..b4e665de 100644 --- a/src/quickcontrols2/qquickanimatednode.cpp +++ b/src/quickcontrols2/qquickanimatednode.cpp @@ -44,12 +44,7 @@ QT_BEGIN_NAMESPACE QQuickAnimatedNode::QQuickAnimatedNode(QQuickItem *target) - : m_running(false), - m_duration(0), - m_loopCount(1), - m_currentTime(0), - m_currentLoop(0), - m_window(target->window()) + : m_window(target->window()) { } diff --git a/src/quickcontrols2/qquickanimatednode_p.h b/src/quickcontrols2/qquickanimatednode_p.h index 2e355e9a..d42d9319 100644 --- a/src/quickcontrols2/qquickanimatednode_p.h +++ b/src/quickcontrols2/qquickanimatednode_p.h @@ -98,13 +98,13 @@ private Q_SLOTS: void update(); private: - bool m_running; - int m_duration; - int m_loopCount; - int m_currentTime; - int m_currentLoop; + bool m_running = false; + int m_duration = 0; + int m_loopCount = 1; + int m_currentTime = 0; + int m_currentLoop = 0; QElapsedTimer m_timer; - QQuickWindow *m_window; + QQuickWindow *m_window = nullptr; }; QT_END_NAMESPACE diff --git a/src/quickcontrols2/qquickclippedtext.cpp b/src/quickcontrols2/qquickclippedtext.cpp index 7f113592..862197f3 100644 --- a/src/quickcontrols2/qquickclippedtext.cpp +++ b/src/quickcontrols2/qquickclippedtext.cpp @@ -41,13 +41,7 @@ QT_BEGIN_NAMESPACE QQuickClippedText::QQuickClippedText(QQuickItem *parent) - : QQuickText(parent), - m_hasClipWidth(false), - m_hasClipHeight(false), - m_clipX(0), - m_clipY(0), - m_clipWidth(0), - m_clipHeight(0) + : QQuickText(parent) { } diff --git a/src/quickcontrols2/qquickclippedtext_p.h b/src/quickcontrols2/qquickclippedtext_p.h index 7521525f..486ac7c4 100644 --- a/src/quickcontrols2/qquickclippedtext_p.h +++ b/src/quickcontrols2/qquickclippedtext_p.h @@ -81,12 +81,12 @@ public: private: void markClipDirty(); - bool m_hasClipWidth; - bool m_hasClipHeight; - qreal m_clipX; - qreal m_clipY; - qreal m_clipWidth; - qreal m_clipHeight; + bool m_hasClipWidth = false; + bool m_hasClipHeight = false; + qreal m_clipX = 0; + qreal m_clipY = 0; + qreal m_clipWidth = 0; + qreal m_clipHeight = 0; }; QT_END_NAMESPACE diff --git a/src/quickcontrols2/qquickcolorimage.cpp b/src/quickcontrols2/qquickcolorimage.cpp index 9d24a156..3afcef7e 100644 --- a/src/quickcontrols2/qquickcolorimage.cpp +++ b/src/quickcontrols2/qquickcolorimage.cpp @@ -41,7 +41,7 @@ QT_BEGIN_NAMESPACE QQuickColorImage::QQuickColorImage(QQuickItem *parent) - : QQuickImage(parent), m_color(Qt::transparent), m_defaultColor(Qt::transparent) + : QQuickImage(parent) { } diff --git a/src/quickcontrols2/qquickcolorimage_p.h b/src/quickcontrols2/qquickcolorimage_p.h index 873bc2db..8227d068 100644 --- a/src/quickcontrols2/qquickcolorimage_p.h +++ b/src/quickcontrols2/qquickcolorimage_p.h @@ -79,8 +79,8 @@ protected: void pixmapChange() override; private: - QColor m_color; - QColor m_defaultColor; + QColor m_color = Qt::transparent; + QColor m_defaultColor = Qt::transparent; }; QT_END_NAMESPACE diff --git a/src/quickcontrols2/qquickiconimage.cpp b/src/quickcontrols2/qquickiconimage.cpp index 885bc7f9..c8357647 100644 --- a/src/quickcontrols2/qquickiconimage.cpp +++ b/src/quickcontrols2/qquickiconimage.cpp @@ -42,14 +42,6 @@ QT_BEGIN_NAMESPACE -QQuickIconImagePrivate::QQuickIconImagePrivate() - : color(Qt::transparent), - updatingIcon(false), - isThemeIcon(false), - updatingFillMode(false) -{ -} - bool QQuickIconImagePrivate::updateDevicePixelRatio(qreal targetDevicePixelRatio) { if (isThemeIcon) { diff --git a/src/quickcontrols2/qquickiconimage_p_p.h b/src/quickcontrols2/qquickiconimage_p_p.h index 8e8012bf..0c755ff6 100644 --- a/src/quickcontrols2/qquickiconimage_p_p.h +++ b/src/quickcontrols2/qquickiconimage_p_p.h @@ -59,19 +59,17 @@ class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickIconImagePrivate : public QQuickImag Q_DECLARE_PUBLIC(QQuickIconImage) public: - QQuickIconImagePrivate(); - void updateIcon(); void updateFillMode(); qreal calculateDevicePixelRatio() const; bool updateDevicePixelRatio(qreal targetDevicePixelRatio) override; QUrl source; - QColor color; + QColor color = Qt::transparent; QThemeIconInfo icon; - bool updatingIcon; - bool isThemeIcon; - bool updatingFillMode; + bool updatingIcon = false; + bool isThemeIcon = false; + bool updatingFillMode = false; }; QT_END_NAMESPACE diff --git a/src/quickcontrols2/qquickiconlabel.cpp b/src/quickcontrols2/qquickiconlabel.cpp index 960d9905..6232b48c 100644 --- a/src/quickcontrols2/qquickiconlabel.cpp +++ b/src/quickcontrols2/qquickiconlabel.cpp @@ -57,20 +57,6 @@ static void completeComponent(QQuickItem *item) parserStatus->componentComplete(); } -QQuickIconLabelPrivate::QQuickIconLabelPrivate() - : mirrored(false), - display(QQuickIconLabel::TextBesideIcon), - alignment(Qt::AlignCenter), - spacing(0), - topPadding(0), - leftPadding(0), - rightPadding(0), - bottomPadding(0), - image(nullptr), - label(nullptr) -{ -} - bool QQuickIconLabelPrivate::hasIcon() const { return display != QQuickIconLabel::TextOnly && !icon.isEmpty(); diff --git a/src/quickcontrols2/qquickiconlabel_p_p.h b/src/quickcontrols2/qquickiconlabel_p_p.h index f0f4df4c..6a2a0f58 100644 --- a/src/quickcontrols2/qquickiconlabel_p_p.h +++ b/src/quickcontrols2/qquickiconlabel_p_p.h @@ -62,8 +62,6 @@ class QQuickIconLabelPrivate : public QQuickItemPrivate, public QQuickItemChange Q_DECLARE_PUBLIC(QQuickIconLabel) public: - explicit QQuickIconLabelPrivate(); - bool hasIcon() const; bool hasText() const; @@ -92,20 +90,20 @@ public: void itemImplicitHeightChanged(QQuickItem *) override; void itemDestroyed(QQuickItem *item) override; - bool mirrored; - QQuickIconLabel::Display display; - Qt::Alignment alignment; - qreal spacing; - qreal topPadding; - qreal leftPadding; - qreal rightPadding; - qreal bottomPadding; + bool mirrored = false; + QQuickIconLabel::Display display = QQuickIconLabel::TextBesideIcon; + Qt::Alignment alignment = Qt::AlignCenter; + qreal spacing = 0; + qreal topPadding = 0; + qreal leftPadding = 0; + qreal rightPadding = 0; + qreal bottomPadding = 0; QFont font; QColor color; QString text; QQuickIcon icon; - QQuickIconImage *image; - QQuickMnemonicLabel *label; + QQuickIconImage *image = nullptr; + QQuickMnemonicLabel *label = nullptr; }; QT_END_NAMESPACE diff --git a/src/quickcontrols2/qquickmnemoniclabel.cpp b/src/quickcontrols2/qquickmnemoniclabel.cpp index 9c8e9ab1..a006f076 100644 --- a/src/quickcontrols2/qquickmnemoniclabel.cpp +++ b/src/quickcontrols2/qquickmnemoniclabel.cpp @@ -41,8 +41,7 @@ QT_BEGIN_NAMESPACE QQuickMnemonicLabel::QQuickMnemonicLabel(QQuickItem *parent) - : QQuickText(parent), - m_mnemonicVisible(true) + : QQuickText(parent) { } diff --git a/src/quickcontrols2/qquickmnemoniclabel_p.h b/src/quickcontrols2/qquickmnemoniclabel_p.h index 33bc1e08..da5a83db 100644 --- a/src/quickcontrols2/qquickmnemoniclabel_p.h +++ b/src/quickcontrols2/qquickmnemoniclabel_p.h @@ -71,7 +71,7 @@ public: private: void updateMnemonic(); - bool m_mnemonicVisible; + bool m_mnemonicVisible = true; QString m_fullText; }; diff --git a/src/quickcontrols2/qquickpaddedrectangle.cpp b/src/quickcontrols2/qquickpaddedrectangle.cpp index f7088d54..fd9e9d90 100644 --- a/src/quickcontrols2/qquickpaddedrectangle.cpp +++ b/src/quickcontrols2/qquickpaddedrectangle.cpp @@ -41,9 +41,7 @@ QT_BEGIN_NAMESPACE QQuickPaddedRectangle::QQuickPaddedRectangle(QQuickItem *parent) : - QQuickRectangle(parent), m_padding(0), - m_topPadding(0), m_leftPadding(0), m_rightPadding(0), m_bottomPadding(0), - m_hasTopPadding(false), m_hasLeftPadding(false), m_hasRightPadding(false), m_hasBottomPadding(false) + QQuickRectangle(parent) { } diff --git a/src/quickcontrols2/qquickpaddedrectangle_p.h b/src/quickcontrols2/qquickpaddedrectangle_p.h index 261691ee..c2e0ddef 100644 --- a/src/quickcontrols2/qquickpaddedrectangle_p.h +++ b/src/quickcontrols2/qquickpaddedrectangle_p.h @@ -101,15 +101,15 @@ private: void setRightPadding(qreal padding, bool has); void setBottomPadding(qreal padding, bool has); - qreal m_padding; - qreal m_topPadding; - qreal m_leftPadding; - qreal m_rightPadding; - qreal m_bottomPadding; - bool m_hasTopPadding; - bool m_hasLeftPadding; - bool m_hasRightPadding; - bool m_hasBottomPadding; + qreal m_padding = 0; + qreal m_topPadding = 0; + qreal m_leftPadding = 0; + qreal m_rightPadding = 0; + qreal m_bottomPadding = 0; + bool m_hasTopPadding = false; + bool m_hasLeftPadding = false; + bool m_hasRightPadding = false; + bool m_hasBottomPadding = false; }; QT_END_NAMESPACE diff --git a/src/quickcontrols2/qquicktumblerview.cpp b/src/quickcontrols2/qquicktumblerview.cpp index 4469810c..59d05211 100644 --- a/src/quickcontrols2/qquicktumblerview.cpp +++ b/src/quickcontrols2/qquicktumblerview.cpp @@ -46,12 +46,7 @@ QT_BEGIN_NAMESPACE QQuickTumblerView::QQuickTumblerView(QQuickItem *parent) : - QQuickItem(parent), - m_tumbler(nullptr), - m_delegate(nullptr), - m_pathView(nullptr), - m_listView(nullptr), - m_path(nullptr) + QQuickItem(parent) { // We don't call createView() here because we don't know what the wrap flag is set to // yet, and we don't want to create a view that might never get used. diff --git a/src/quickcontrols2/qquicktumblerview_p.h b/src/quickcontrols2/qquicktumblerview_p.h index 0ab0c3a9..138af1b4 100644 --- a/src/quickcontrols2/qquicktumblerview_p.h +++ b/src/quickcontrols2/qquicktumblerview_p.h @@ -96,12 +96,12 @@ private: void wrapChange(); - QQuickTumbler *m_tumbler; + QQuickTumbler *m_tumbler = nullptr; QVariant m_model; - QQmlComponent *m_delegate; - QQuickPathView *m_pathView; - QQuickListView *m_listView; - QQuickPath *m_path; + QQmlComponent *m_delegate = nullptr; + QQuickPathView *m_pathView = nullptr; + QQuickListView *m_listView = nullptr; + QQuickPath *m_path = nullptr; }; QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquickabstractbutton.cpp b/src/quicktemplates2/qquickabstractbutton.cpp index 9f92155e..dd38b80e 100644 --- a/src/quicktemplates2/qquickabstractbutton.cpp +++ b/src/quicktemplates2/qquickabstractbutton.cpp @@ -51,10 +51,6 @@ QT_BEGIN_NAMESPACE -// copied from qabstractbutton.cpp -static const int AUTO_REPEAT_DELAY = 300; -static const int AUTO_REPEAT_INTERVAL = 100; - /*! \qmltype AbstractButton \inherits Control @@ -117,33 +113,6 @@ static const int AUTO_REPEAT_INTERVAL = 100; This signal is emitted when the button is interactively double clicked by the user via touch or mouse. */ -QQuickAbstractButtonPrivate::QQuickAbstractButtonPrivate() - : explicitText(false), - down(false), - explicitDown(false), - pressed(false), - keepPressed(false), - checked(false), - checkable(false), - autoExclusive(false), - autoRepeat(false), - wasHeld(false), - holdTimer(0), - delayTimer(0), - repeatTimer(0), - repeatDelay(AUTO_REPEAT_DELAY), - repeatInterval(AUTO_REPEAT_INTERVAL), -#if QT_CONFIG(shortcut) - shortcutId(0), -#endif - pressButtons(Qt::NoButton), - indicator(nullptr), - group(nullptr), - display(QQuickAbstractButton::TextBesideIcon), - action(nullptr) -{ -} - void QQuickAbstractButtonPrivate::setPressPoint(const QPointF &point) { pressPoint = point; diff --git a/src/quicktemplates2/qquickabstractbutton_p_p.h b/src/quicktemplates2/qquickabstractbutton_p_p.h index d88e5d31..718498a8 100644 --- a/src/quicktemplates2/qquickabstractbutton_p_p.h +++ b/src/quicktemplates2/qquickabstractbutton_p_p.h @@ -62,8 +62,6 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickAbstractButtonPrivate : public QQui Q_DECLARE_PUBLIC(QQuickAbstractButton) public: - QQuickAbstractButtonPrivate(); - static QQuickAbstractButtonPrivate *get(QQuickAbstractButton *button) { return button->d_func(); @@ -108,34 +106,38 @@ public: void itemImplicitWidthChanged(QQuickItem *item) override; void itemImplicitHeightChanged(QQuickItem *item) override; - QString text; - bool explicitText; - bool down; - bool explicitDown; - bool pressed; - bool keepPressed; - bool checked; - bool checkable; - bool autoExclusive; - bool autoRepeat; - bool wasHeld; - int holdTimer; - int delayTimer; - int repeatTimer; - int repeatDelay; - int repeatInterval; + // copied from qabstractbutton.cpp + static const int AUTO_REPEAT_DELAY = 300; + static const int AUTO_REPEAT_INTERVAL = 100; + + bool explicitText = false; + bool down = false; + bool explicitDown = false; + bool pressed = false; + bool keepPressed = false; + bool checked = false; + bool checkable = false; + bool autoExclusive = false; + bool autoRepeat = false; + bool wasHeld = false; + int holdTimer = 0; + int delayTimer = 0; + int repeatTimer = 0; + int repeatDelay = AUTO_REPEAT_DELAY; + int repeatInterval = AUTO_REPEAT_INTERVAL; #if QT_CONFIG(shortcut) - int shortcutId; + int shortcutId = 0; QKeySequence shortcut; #endif + QString text; QQuickIcon icon; QQuickIcon effectiveIcon; QPointF pressPoint; QPointF movePoint; - Qt::MouseButtons pressButtons; + Qt::MouseButtons pressButtons = Qt::NoButton; + QQuickAbstractButton::Display display = QQuickAbstractButton::TextBesideIcon; QQuickDeferredPointer<QQuickItem> indicator; - QQuickButtonGroup *group; - QQuickAbstractButton::Display display; + QQuickButtonGroup *group = nullptr; QPointer<QQuickAction> action; }; diff --git a/src/quicktemplates2/qquickaction.cpp b/src/quicktemplates2/qquickaction.cpp index fd899d0b..6ff3a183 100644 --- a/src/quicktemplates2/qquickaction.cpp +++ b/src/quicktemplates2/qquickaction.cpp @@ -121,8 +121,7 @@ static QKeySequence variantToKeySequence(const QVariant &var) } QQuickActionPrivate::ShortcutEntry::ShortcutEntry(QObject *target) - : m_shortcutId(0), - m_target(target) + : m_target(target) { } @@ -170,16 +169,6 @@ void QQuickActionPrivate::ShortcutEntry::setEnabled(bool enabled) QGuiApplicationPrivate::instance()->shortcutMap.setShortcutEnabled(enabled, m_shortcutId, m_target); } -QQuickActionPrivate::QQuickActionPrivate() - : explicitEnabled(false), - enabled(true), - checked(false), - checkable(false), - defaultShortcutEntry(nullptr), - group(nullptr) -{ -} - QVariant QQuickActionPrivate::shortcut() const { return vshortcut; diff --git a/src/quicktemplates2/qquickaction_p_p.h b/src/quicktemplates2/qquickaction_p_p.h index 331bcb65..98b0973b 100644 --- a/src/quicktemplates2/qquickaction_p_p.h +++ b/src/quicktemplates2/qquickaction_p_p.h @@ -64,8 +64,6 @@ class QQuickActionPrivate : public QObjectPrivate, public QQuickItemChangeListen Q_DECLARE_PUBLIC(QQuickAction) public: - QQuickActionPrivate(); - static QQuickActionPrivate *get(QQuickAction *action) { return action->d_func(); @@ -104,24 +102,24 @@ public: void setEnabled(bool enabled); private: - int m_shortcutId; - QObject *m_target; + int m_shortcutId = 0; + QObject *m_target = nullptr; }; ShortcutEntry *findShortcutEntry(QObject *target) const; void updateDefaultShortcutEntry(); - bool explicitEnabled; - bool enabled; - bool checked; - bool checkable; + bool explicitEnabled = false; + bool enabled = true; + bool checked = false; + bool checkable = false; QString text; QQuickIcon icon; QVariant vshortcut; QKeySequence keySequence; - ShortcutEntry *defaultShortcutEntry; + ShortcutEntry *defaultShortcutEntry = nullptr; QVector<ShortcutEntry *> shortcutEntries; - QQuickActionGroup *group; + QQuickActionGroup *group = nullptr; }; QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquickactiongroup.cpp b/src/quicktemplates2/qquickactiongroup.cpp index 64895689..f831660b 100644 --- a/src/quicktemplates2/qquickactiongroup.cpp +++ b/src/quicktemplates2/qquickactiongroup.cpp @@ -142,13 +142,6 @@ class QQuickActionGroupPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QQuickActionGroup) public: - QQuickActionGroupPrivate() - : enabled(true), - exclusive(true), - checkedAction(nullptr) - { - } - void clear(); void actionTriggered(); void _q_updateCurrent(); @@ -160,8 +153,8 @@ public: static QQuickAction *actions_at(QQmlListProperty<QQuickAction> *prop, int index); static void actions_clear(QQmlListProperty<QQuickAction> *prop); - bool enabled; - bool exclusive; + bool enabled = true; + bool exclusive = true; QPointer<QQuickAction> checkedAction; QVector<QQuickAction*> actions; }; @@ -423,9 +416,7 @@ void QQuickActionGroup::removeAction(QQuickAction *action) class QQuickActionGroupAttachedPrivate : public QObjectPrivate { public: - QQuickActionGroupAttachedPrivate() : group(nullptr) { } - - QQuickActionGroup *group; + QQuickActionGroup *group = nullptr; }; QQuickActionGroupAttached::QQuickActionGroupAttached(QObject *parent) diff --git a/src/quicktemplates2/qquickapplicationwindow.cpp b/src/quicktemplates2/qquickapplicationwindow.cpp index b2ca40f4..e92dc3cd 100644 --- a/src/quicktemplates2/qquickapplicationwindow.cpp +++ b/src/quicktemplates2/qquickapplicationwindow.cpp @@ -124,18 +124,6 @@ class QQuickApplicationWindowPrivate : public QQuickItemChangeListener Q_DECLARE_PUBLIC(QQuickApplicationWindow) public: - QQuickApplicationWindowPrivate() - : complete(true), - background(nullptr), - contentItem(nullptr), - menuBar(nullptr), - header(nullptr), - footer(nullptr), - overlay(nullptr), - activeFocusControl(nullptr) - { - } - static QQuickApplicationWindowPrivate *get(QQuickApplicationWindow *window) { return window->d_func(); @@ -174,18 +162,18 @@ public: void cancelBackground(); void executeBackground(bool complete = false); - bool complete; + bool complete = true; QQuickDeferredPointer<QQuickItem> background; - QQuickItem *contentItem; - QQuickItem *menuBar; - QQuickItem *header; - QQuickItem *footer; - QQuickOverlay *overlay; + QQuickItem *contentItem = nullptr; + QQuickItem *menuBar = nullptr; + QQuickItem *header = nullptr; + QQuickItem *footer = nullptr; + QQuickOverlay *overlay = nullptr; QFont font; QLocale locale; QPalette palette; - QQuickItem *activeFocusControl; - QQuickApplicationWindow *q_ptr; + QQuickItem *activeFocusControl = nullptr; + QQuickApplicationWindow *q_ptr = nullptr; }; static void layoutItem(QQuickItem *item, qreal y, qreal width) @@ -866,17 +854,11 @@ class QQuickApplicationWindowAttachedPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QQuickApplicationWindowAttached) public: - QQuickApplicationWindowAttachedPrivate() - : window(nullptr), - activeFocusControl(nullptr) - { - } - void windowChange(QQuickWindow *wnd); void activeFocusChange(); - QQuickWindow *window; - QQuickItem *activeFocusControl; + QQuickWindow *window = nullptr; + QQuickItem *activeFocusControl = nullptr; }; void QQuickApplicationWindowAttachedPrivate::windowChange(QQuickWindow *wnd) diff --git a/src/quicktemplates2/qquickbusyindicator.cpp b/src/quicktemplates2/qquickbusyindicator.cpp index e4f20d83..eea8eadb 100644 --- a/src/quicktemplates2/qquickbusyindicator.cpp +++ b/src/quicktemplates2/qquickbusyindicator.cpp @@ -79,9 +79,7 @@ QT_BEGIN_NAMESPACE class QQuickBusyIndicatorPrivate : public QQuickControlPrivate { public: - QQuickBusyIndicatorPrivate() : running(true) { } - - bool running; + bool running = true; }; QQuickBusyIndicator::QQuickBusyIndicator(QQuickItem *parent) diff --git a/src/quicktemplates2/qquickbutton.cpp b/src/quicktemplates2/qquickbutton.cpp index ce8cede7..5e4d3036 100644 --- a/src/quicktemplates2/qquickbutton.cpp +++ b/src/quicktemplates2/qquickbutton.cpp @@ -84,12 +84,6 @@ QT_BEGIN_NAMESPACE \sa {Customizing Button}, {Button Controls} */ -QQuickButtonPrivate::QQuickButtonPrivate() - : flat(false), - highlighted(false) -{ -} - QQuickButton::QQuickButton(QQuickItem *parent) : QQuickAbstractButton(*(new QQuickButtonPrivate), parent) { diff --git a/src/quicktemplates2/qquickbutton_p_p.h b/src/quicktemplates2/qquickbutton_p_p.h index 5aaf2788..1d02e2ea 100644 --- a/src/quicktemplates2/qquickbutton_p_p.h +++ b/src/quicktemplates2/qquickbutton_p_p.h @@ -57,10 +57,8 @@ class QQuickButtonPrivate : public QQuickAbstractButtonPrivate Q_DECLARE_PUBLIC(QQuickButton) public: - QQuickButtonPrivate(); - - bool flat; - bool highlighted; + bool flat = false; + bool highlighted = false; }; QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquickbuttongroup.cpp b/src/quicktemplates2/qquickbuttongroup.cpp index e2b1a557..cddfb199 100644 --- a/src/quicktemplates2/qquickbuttongroup.cpp +++ b/src/quicktemplates2/qquickbuttongroup.cpp @@ -154,14 +154,6 @@ class QQuickButtonGroupPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QQuickButtonGroup) public: - QQuickButtonGroupPrivate() - : complete(true), - exclusive(true), - settingCheckState(false), - checkState(Qt::Unchecked) - { - } - void clear(); void buttonClicked(); void _q_updateCurrent(); @@ -173,10 +165,10 @@ public: static QQuickAbstractButton *buttons_at(QQmlListProperty<QQuickAbstractButton> *prop, int index); static void buttons_clear(QQmlListProperty<QQuickAbstractButton> *prop); - bool complete; - bool exclusive; - bool settingCheckState; - Qt::CheckState checkState; + bool complete = true; + bool exclusive = true; + bool settingCheckState = false; + Qt::CheckState checkState = Qt::Unchecked; QPointer<QQuickAbstractButton> checkedButton; QVector<QQuickAbstractButton*> buttons; }; @@ -500,9 +492,7 @@ void QQuickButtonGroup::componentComplete() class QQuickButtonGroupAttachedPrivate : public QObjectPrivate { public: - QQuickButtonGroupAttachedPrivate() : group(nullptr) { } - - QQuickButtonGroup *group; + QQuickButtonGroup *group = nullptr; }; QQuickButtonGroupAttached::QQuickButtonGroupAttached(QObject *parent) diff --git a/src/quicktemplates2/qquickcheckbox.cpp b/src/quicktemplates2/qquickcheckbox.cpp index cb2e62e7..55d39685 100644 --- a/src/quicktemplates2/qquickcheckbox.cpp +++ b/src/quicktemplates2/qquickcheckbox.cpp @@ -102,16 +102,10 @@ class QQuickCheckBoxPrivate : public QQuickAbstractButtonPrivate Q_DECLARE_PUBLIC(QQuickCheckBox) public: - QQuickCheckBoxPrivate() - : tristate(false), - checkState(Qt::Unchecked) - { - } - void setNextCheckState(const QJSValue &callback); - bool tristate; - Qt::CheckState checkState; + bool tristate = false; + Qt::CheckState checkState = Qt::Unchecked; QJSValue nextCheckState; }; diff --git a/src/quicktemplates2/qquickcheckdelegate.cpp b/src/quicktemplates2/qquickcheckdelegate.cpp index 35de80ec..9c4a84f5 100644 --- a/src/quicktemplates2/qquickcheckdelegate.cpp +++ b/src/quicktemplates2/qquickcheckdelegate.cpp @@ -89,16 +89,10 @@ class QQuickCheckDelegatePrivate : public QQuickItemDelegatePrivate Q_DECLARE_PUBLIC(QQuickCheckDelegate) public: - QQuickCheckDelegatePrivate() - : tristate(false), - checkState(Qt::Unchecked) - { - } - void setNextCheckState(const QJSValue &callback); - bool tristate; - Qt::CheckState checkState; + bool tristate = false; + Qt::CheckState checkState = Qt::Unchecked; QJSValue nextCheckState; }; diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp index d4280b30..d018be44 100644 --- a/src/quicktemplates2/qquickcombobox.cpp +++ b/src/quicktemplates2/qquickcombobox.cpp @@ -187,7 +187,7 @@ public: QString stringValue(int index, const QString &role) override; private: - QQuickComboBox *combo; + QQuickComboBox *combo = nullptr; }; QQuickComboBoxDelegateModel::QQuickComboBoxDelegateModel(QQuickComboBox *combo) @@ -220,8 +220,6 @@ class QQuickComboBoxPrivate : public QQuickControlPrivate Q_DECLARE_PUBLIC(QQuickComboBox) public: - QQuickComboBoxPrivate(); - bool isPopupVisible() const; void showPopup(); void hidePopup(bool accept); @@ -266,62 +264,37 @@ public: void itemImplicitWidthChanged(QQuickItem *item) override; void itemImplicitHeightChanged(QQuickItem *item) override; - bool flat; - bool down; - bool hasDown; - bool pressed; - bool ownModel; - bool keyNavigating; - bool hasDisplayText; - bool hasCurrentIndex; - int highlightedIndex; - int currentIndex; + bool flat = false; + bool down = false; + bool hasDown = false; + bool pressed = false; + bool ownModel = false; + bool keyNavigating = false; + bool hasDisplayText = false; + bool hasCurrentIndex = false; + int highlightedIndex = -1; + int currentIndex = -1; QVariant model; QString textRole; QString currentText; QString displayText; - QQuickItem *pressedItem; - QQmlInstanceModel *delegateModel; - QQmlComponent *delegate; + QQuickItem *pressedItem = nullptr; + QQmlInstanceModel *delegateModel = nullptr; + QQmlComponent *delegate = nullptr; QQuickDeferredPointer<QQuickItem> indicator; QQuickDeferredPointer<QQuickPopup> popup; struct ExtraData { - ExtraData() - : editable(false), - accepting(false), - allowComplete(false), - inputMethodHints(Qt::ImhNone), - validator(nullptr) { } - - bool editable; - bool accepting; - bool allowComplete; - Qt::InputMethodHints inputMethodHints; + bool editable = false; + bool accepting = false; + bool allowComplete = false; + Qt::InputMethodHints inputMethodHints = Qt::ImhNone; QString editText; - QValidator *validator; + QValidator *validator = nullptr; }; QLazilyAllocated<ExtraData> extra; }; -QQuickComboBoxPrivate::QQuickComboBoxPrivate() - : flat(false), - down(false), - hasDown(false), - pressed(false), - ownModel(false), - keyNavigating(false), - hasDisplayText(false), - hasCurrentIndex(false), - highlightedIndex(-1), - currentIndex(-1), - delegateModel(nullptr), - delegate(nullptr), - indicator(nullptr), - popup(nullptr) -{ -} - bool QQuickComboBoxPrivate::isPopupVisible() const { return popup && popup->isVisible(); @@ -920,6 +893,8 @@ int QQuickComboBox::highlightedIndex() const This property holds the index of the current item in the combo box. + The default value is \c -1 when \l count is \c 0, and \c 0 otherwise. + \sa activated(), currentText, highlightedIndex */ int QQuickComboBox::currentIndex() const diff --git a/src/quicktemplates2/qquickcontainer.cpp b/src/quicktemplates2/qquickcontainer.cpp index 44f943d9..6015eca7 100644 --- a/src/quicktemplates2/qquickcontainer.cpp +++ b/src/quicktemplates2/qquickcontainer.cpp @@ -192,18 +192,6 @@ static QQuickItem *effectiveContentItem(QQuickItem *item) return item; } -QQuickContainerPrivate::QQuickContainerPrivate() - : hasContentWidth(false), - hasContentHeight(false), - contentWidth(0), - contentHeight(0), - contentModel(nullptr), - currentIndex(-1), - updatingCurrent(false), - changeTypes(Destroyed | Parent | SiblingOrder) -{ -} - void QQuickContainerPrivate::init() { Q_Q(QQuickContainer); diff --git a/src/quicktemplates2/qquickcontainer_p_p.h b/src/quicktemplates2/qquickcontainer_p_p.h index 28190f07..16e9c9f6 100644 --- a/src/quicktemplates2/qquickcontainer_p_p.h +++ b/src/quicktemplates2/qquickcontainer_p_p.h @@ -59,8 +59,6 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickContainerPrivate : public QQuickCon Q_DECLARE_PUBLIC(QQuickContainer) public: - QQuickContainerPrivate(); - static QQuickContainerPrivate *get(QQuickContainer *container) { return container->d_func(); @@ -95,15 +93,15 @@ public: void updateContentWidth(); void updateContentHeight(); - bool hasContentWidth; - bool hasContentHeight; - qreal contentWidth; - qreal contentHeight; + bool hasContentWidth = false; + bool hasContentHeight = false; + qreal contentWidth = 0; + qreal contentHeight = 0; QObjectList contentData; - QQmlObjectModel *contentModel; - int currentIndex; - bool updatingCurrent; - QQuickItemPrivate::ChangeTypes changeTypes; + QQmlObjectModel *contentModel = nullptr; + int currentIndex = -1; + bool updatingCurrent = false; + QQuickItemPrivate::ChangeTypes changeTypes = Destroyed | Parent | SiblingOrder; }; QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp index 81950ee5..7174ba35 100644 --- a/src/quicktemplates2/qquickcontrol.cpp +++ b/src/quicktemplates2/qquickcontrol.cpp @@ -137,50 +137,7 @@ static bool isKeyFocusReason(Qt::FocusReason reason) return reason == Qt::TabFocusReason || reason == Qt::BacktabFocusReason || reason == Qt::ShortcutFocusReason; } -QQuickControlPrivate::ExtraData::ExtraData() - : hasTopPadding(false), - hasLeftPadding(false), - hasRightPadding(false), - hasBottomPadding(false), - hasBaselineOffset(false), - hasTopInset(false), - hasLeftInset(false), - hasRightInset(false), - hasBottomInset(false), - hasBackgroundWidth(false), - hasBackgroundHeight(false), - topPadding(0), - leftPadding(0), - rightPadding(0), - bottomPadding(0), - topInset(0), - leftInset(0), - rightInset(0), - bottomInset(0) -{ -} - QQuickControlPrivate::QQuickControlPrivate() - : hasHorizontalPadding(false), - hasVerticalPadding(false), - hasLocale(false), - wheelEnabled(false), -#if QT_CONFIG(quicktemplates2_hover) - hovered(false), - explicitHoverEnabled(false), -#endif - resizingBackground(false), - touchId(-1), - padding(0), - horizontalPadding(0), - verticalPadding(0), - implicitContentWidth(0), - implicitContentHeight(0), - spacing(0), - focusPolicy(Qt::NoFocus), - focusReason(Qt::OtherFocusReason), - background(nullptr), - contentItem(nullptr) { #if QT_CONFIG(accessibility) QAccessible::installActivationObserver(this); diff --git a/src/quicktemplates2/qquickcontrol_p_p.h b/src/quicktemplates2/qquickcontrol_p_p.h index 79d668aa..a657307b 100644 --- a/src/quicktemplates2/qquickcontrol_p_p.h +++ b/src/quicktemplates2/qquickcontrol_p_p.h @@ -73,7 +73,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickControlPrivate : public QQuickItemP public: QQuickControlPrivate(); - virtual ~QQuickControlPrivate(); + ~QQuickControlPrivate(); static QQuickControlPrivate *get(QQuickControl *control) { @@ -191,52 +191,51 @@ public: void updateImplicitContentSize(); struct ExtraData { - ExtraData(); - bool hasTopPadding; - bool hasLeftPadding; - bool hasRightPadding; - bool hasBottomPadding; - bool hasBaselineOffset; - bool hasTopInset; - bool hasLeftInset; - bool hasRightInset; - bool hasBottomInset; - bool hasBackgroundWidth; - bool hasBackgroundHeight; - qreal topPadding; - qreal leftPadding; - qreal rightPadding; - qreal bottomPadding; - qreal topInset; - qreal leftInset; - qreal rightInset; - qreal bottomInset; + bool hasTopPadding = false; + bool hasLeftPadding = false; + bool hasRightPadding = false; + bool hasBottomPadding = false; + bool hasBaselineOffset = false; + bool hasTopInset = false; + bool hasLeftInset = false; + bool hasRightInset = false; + bool hasBottomInset = false; + bool hasBackgroundWidth = false; + bool hasBackgroundHeight = false; + qreal topPadding = 0; + qreal leftPadding = 0; + qreal rightPadding = 0; + qreal bottomPadding = 0; + qreal topInset = 0; + qreal leftInset = 0; + qreal rightInset = 0; + qreal bottomInset = 0; QFont requestedFont; QPalette requestedPalette; }; QLazilyAllocated<ExtraData> extra; - bool hasHorizontalPadding; - bool hasVerticalPadding; - bool hasLocale; - bool wheelEnabled; + bool hasHorizontalPadding = false; + bool hasVerticalPadding = false; + bool hasLocale = false; + bool wheelEnabled = false; #if QT_CONFIG(quicktemplates2_hover) - bool hovered; - bool explicitHoverEnabled; + bool hovered = false; + bool explicitHoverEnabled = false; #endif - bool resizingBackground; - int touchId; - qreal padding; - qreal horizontalPadding; - qreal verticalPadding; - qreal implicitContentWidth; - qreal implicitContentHeight; - qreal spacing; + bool resizingBackground = false; + int touchId = -1; + qreal padding = 0; + qreal horizontalPadding = 0; + qreal verticalPadding = 0; + qreal implicitContentWidth = 0; + qreal implicitContentHeight = 0; + qreal spacing = 0; QLocale locale; QFont resolvedFont; QPalette resolvedPalette; - Qt::FocusPolicy focusPolicy; - Qt::FocusReason focusReason; + Qt::FocusPolicy focusPolicy = Qt::NoFocus; + Qt::FocusReason focusReason = Qt::OtherFocusReason; QQuickDeferredPointer<QQuickItem> background; QQuickDeferredPointer<QQuickItem> contentItem; }; diff --git a/src/quicktemplates2/qquickdeferredpointer_p_p.h b/src/quicktemplates2/qquickdeferredpointer_p_p.h index c793964f..f70b5dc6 100644 --- a/src/quicktemplates2/qquickdeferredpointer_p_p.h +++ b/src/quicktemplates2/qquickdeferredpointer_p_p.h @@ -79,7 +79,7 @@ public: inline QQuickDeferredPointer<T> &operator=(const QQuickDeferredPointer &o); private: - quintptr ptr_value; + quintptr ptr_value = 0; static const quintptr WasExecutedBit = 0x1; static const quintptr IsExecutingBit = 0x2; @@ -88,7 +88,6 @@ private: template<typename T> QQuickDeferredPointer<T>::QQuickDeferredPointer() -: ptr_value(0) { } diff --git a/src/quicktemplates2/qquickdelaybutton.cpp b/src/quicktemplates2/qquickdelaybutton.cpp index 02efc3a2..a42057bd 100644 --- a/src/quicktemplates2/qquickdelaybutton.cpp +++ b/src/quicktemplates2/qquickdelaybutton.cpp @@ -80,15 +80,13 @@ class QQuickDelayButtonPrivate : public QQuickAbstractButtonPrivate Q_DECLARE_PUBLIC(QQuickDelayButton) public: - QQuickDelayButtonPrivate(); - void beginTransition(qreal to); void finishTransition(); void cancelTransition(); - int delay; - qreal progress; - QQuickTransition *transition; + int delay = 300; + qreal progress = 0.0; + QQuickTransition *transition = nullptr; QScopedPointer<QQuickDelayTransitionManager> transitionManager; }; @@ -103,7 +101,7 @@ protected: void finished() override; private: - QQuickDelayButton *m_button; + QQuickDelayButton *m_button = nullptr; }; void QQuickDelayTransitionManager::transition(QQuickTransition *transition, qreal progress) @@ -129,13 +127,6 @@ void QQuickDelayTransitionManager::finished() emit m_button->activated(); } -QQuickDelayButtonPrivate::QQuickDelayButtonPrivate() - : delay(3000), - progress(0.0), - transition(nullptr) -{ -} - void QQuickDelayButtonPrivate::beginTransition(qreal to) { Q_Q(QQuickDelayButton); diff --git a/src/quicktemplates2/qquickdial.cpp b/src/quicktemplates2/qquickdial.cpp index 03aee27e..a4124678 100644 --- a/src/quicktemplates2/qquickdial.cpp +++ b/src/quicktemplates2/qquickdial.cpp @@ -96,21 +96,6 @@ class QQuickDialPrivate : public QQuickControlPrivate Q_DECLARE_PUBLIC(QQuickDial) public: - QQuickDialPrivate() - : from(0), - to(1), - value(0), - position(0), - angle(startAngle), - stepSize(0), - pressed(false), - snapMode(QQuickDial::NoSnap), - wrap(false), - live(true), - handle(nullptr) - { - } - qreal valueAt(qreal position) const; qreal snapPosition(qreal position) const; qreal positionAt(const QPointF &point) const; @@ -126,17 +111,17 @@ public: void cancelHandle(); void executeHandle(bool complete = false); - qreal from; - qreal to; - qreal value; - qreal position; - qreal angle; - qreal stepSize; - bool pressed; + qreal from = 0; + qreal to = 1; + qreal value = 0; + qreal position = 0; + qreal angle = startAngle; + qreal stepSize = 0; + bool pressed = false; QPointF pressPoint; - QQuickDial::SnapMode snapMode; - bool wrap; - bool live; + QQuickDial::SnapMode snapMode = QQuickDial::NoSnap; + bool wrap = false; + bool live = true; QQuickDeferredPointer<QQuickItem> handle; }; diff --git a/src/quicktemplates2/qquickdialog_p_p.h b/src/quicktemplates2/qquickdialog_p_p.h index 70128f34..20dce56c 100644 --- a/src/quicktemplates2/qquickdialog_p_p.h +++ b/src/quicktemplates2/qquickdialog_p_p.h @@ -62,8 +62,6 @@ class QQuickDialogPrivate : public QQuickPopupPrivate Q_DECLARE_PUBLIC(QQuickDialog) public: - QQuickDialogPrivate() : result(0), buttonBox(nullptr) { } - static QQuickDialogPrivate *get(QQuickDialog *dialog) { return dialog->d_func(); @@ -73,9 +71,10 @@ public: void handleClick(QQuickAbstractButton *button); - int result; - QQuickDialogButtonBox *buttonBox; - QPlatformDialogHelper::StandardButtons standardButtons; + int result = 0; + QString title; + QQuickDialogButtonBox *buttonBox = nullptr; + QPlatformDialogHelper::StandardButtons standardButtons = QPlatformDialogHelper::NoButton; }; QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquickdialogbuttonbox.cpp b/src/quicktemplates2/qquickdialogbuttonbox.cpp index 98437500..31b2e646 100644 --- a/src/quicktemplates2/qquickdialogbuttonbox.cpp +++ b/src/quicktemplates2/qquickdialogbuttonbox.cpp @@ -197,16 +197,6 @@ static QQuickDialogButtonBox::ButtonLayout platformButtonLayout() return QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::DialogButtonBoxLayout).value<QQuickDialogButtonBox::ButtonLayout>(); } -QQuickDialogButtonBoxPrivate::QQuickDialogButtonBoxPrivate() - : alignment(0), - position(QQuickDialogButtonBox::Footer), - standardButtons(QPlatformDialogHelper::NoButton), - buttonLayout(platformButtonLayout()), - delegate(nullptr) -{ - changeTypes |= ImplicitWidth | ImplicitHeight; -} - void QQuickDialogButtonBoxPrivate::itemImplicitWidthChanged(QQuickItem *item) { QQuickContainerPrivate::itemImplicitWidthChanged(item); @@ -455,6 +445,9 @@ void QQuickDialogButtonBoxPrivate::removeStandardButtons() QQuickDialogButtonBox::QQuickDialogButtonBox(QQuickItem *parent) : QQuickContainer(*(new QQuickDialogButtonBoxPrivate), parent) { + Q_D(QQuickDialogButtonBox); + d->changeTypes |= QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight; + d->buttonLayout = platformButtonLayout(); } QQuickDialogButtonBox::~QQuickDialogButtonBox() diff --git a/src/quicktemplates2/qquickdialogbuttonbox_p_p.h b/src/quicktemplates2/qquickdialogbuttonbox_p_p.h index 5633d880..5d64918a 100644 --- a/src/quicktemplates2/qquickdialogbuttonbox_p_p.h +++ b/src/quicktemplates2/qquickdialogbuttonbox_p_p.h @@ -58,8 +58,6 @@ class QQuickDialogButtonBoxPrivate : public QQuickContainerPrivate Q_DECLARE_PUBLIC(QQuickDialogButtonBox) public: - QQuickDialogButtonBoxPrivate(); - static QQuickDialogButtonBoxPrivate *get(QQuickDialogButtonBox *box) { return box->d_func(); @@ -80,11 +78,11 @@ public: QQuickAbstractButton *createStandardButton(QPlatformDialogHelper::StandardButton button); void removeStandardButtons(); - Qt::Alignment alignment; - QQuickDialogButtonBox::Position position; - QPlatformDialogHelper::StandardButtons standardButtons; - QQuickDialogButtonBox::ButtonLayout buttonLayout; - QQmlComponent *delegate; + Qt::Alignment alignment = 0; + QQuickDialogButtonBox::Position position = QQuickDialogButtonBox::Footer; + QPlatformDialogHelper::StandardButtons standardButtons = QPlatformDialogHelper::NoButton; + QQuickDialogButtonBox::ButtonLayout buttonLayout = QQuickDialogButtonBox::UnknownLayout; + QQmlComponent *delegate = nullptr; }; class QQuickDialogButtonBoxAttachedPrivate : public QObjectPrivate @@ -92,13 +90,6 @@ class QQuickDialogButtonBoxAttachedPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QQuickDialogButtonBoxAttached) public: - QQuickDialogButtonBoxAttachedPrivate() - : buttonBox(nullptr), - buttonRole(QPlatformDialogHelper::InvalidRole), - standardButton(QPlatformDialogHelper::NoButton) - { - } - static QQuickDialogButtonBoxAttachedPrivate *get(QQuickDialogButtonBoxAttached *q) { return q->d_func(); @@ -106,9 +97,9 @@ public: void setButtonBox(QQuickDialogButtonBox *box); - QQuickDialogButtonBox *buttonBox; - QPlatformDialogHelper::ButtonRole buttonRole; - QPlatformDialogHelper::StandardButton standardButton; + QQuickDialogButtonBox *buttonBox = nullptr; + QPlatformDialogHelper::ButtonRole buttonRole = QPlatformDialogHelper::InvalidRole; + QPlatformDialogHelper::StandardButton standardButton = QPlatformDialogHelper::NoButton; }; QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquickdrawer.cpp b/src/quicktemplates2/qquickdrawer.cpp index cbed2fdb..f2d74b31 100644 --- a/src/quicktemplates2/qquickdrawer.cpp +++ b/src/quicktemplates2/qquickdrawer.cpp @@ -180,15 +180,6 @@ public: void reposition() override; }; -QQuickDrawerPrivate::QQuickDrawerPrivate() - : edge(Qt::LeftEdge), - offset(0), - position(0), - dragMargin(QGuiApplication::styleHints()->startDragDistance()) -{ - setEdge(Qt::LeftEdge); -} - qreal QQuickDrawerPrivate::offsetAt(const QPointF &point) const { qreal offset = positionAt(point) - position; @@ -627,6 +618,10 @@ bool QQuickDrawerPrivate::setEdge(Qt::Edge e) QQuickDrawer::QQuickDrawer(QObject *parent) : QQuickPopup(*(new QQuickDrawerPrivate), parent) { + Q_D(QQuickDrawer); + d->dragMargin = QGuiApplication::styleHints()->startDragDistance(); + d->setEdge(Qt::LeftEdge); + setFocus(true); setModal(true); setFiltersChildMouseEvents(true); diff --git a/src/quicktemplates2/qquickdrawer_p_p.h b/src/quicktemplates2/qquickdrawer_p_p.h index 02339d23..5f1086de 100644 --- a/src/quicktemplates2/qquickdrawer_p_p.h +++ b/src/quicktemplates2/qquickdrawer_p_p.h @@ -59,8 +59,6 @@ class QQuickDrawerPrivate : public QQuickPopupPrivate Q_DECLARE_PUBLIC(QQuickDrawer) public: - QQuickDrawerPrivate(); - static QQuickDrawerPrivate *get(QQuickDrawer *drawer) { return drawer->d_func(); @@ -91,10 +89,10 @@ public: bool setEdge(Qt::Edge edge); - Qt::Edge edge; - qreal offset; - qreal position; - qreal dragMargin; + Qt::Edge edge = Qt::LeftEdge; + qreal offset = 0; + qreal position = 0; + qreal dragMargin = 0; QQuickVelocityCalculator velocityCalculator; }; diff --git a/src/quicktemplates2/qquickgroupbox.cpp b/src/quicktemplates2/qquickgroupbox.cpp index 490d8bdd..cd3b8140 100644 --- a/src/quicktemplates2/qquickgroupbox.cpp +++ b/src/quicktemplates2/qquickgroupbox.cpp @@ -89,8 +89,6 @@ class QQuickGroupBoxPrivate : public QQuickFramePrivate Q_DECLARE_PUBLIC(QQuickGroupBox) public: - QQuickGroupBoxPrivate() : label(nullptr) { } - void cancelLabel(); void executeLabel(bool complete = false); diff --git a/src/quicktemplates2/qquickicon.cpp b/src/quicktemplates2/qquickicon.cpp index 79af62b1..1b8f4797 100644 --- a/src/quicktemplates2/qquickicon.cpp +++ b/src/quicktemplates2/qquickicon.cpp @@ -41,19 +41,11 @@ QT_BEGIN_NAMESPACE class QQuickIconPrivate : public QSharedData { public: - QQuickIconPrivate() - : width(0), - height(0), - color(Qt::transparent), - resolveMask(0) - { - } - QString name; QUrl source; - int width; - int height; - QColor color; + int width = 0; + int height = 0; + QColor color = Qt::transparent; enum ResolveProperties { NameResolved = 0x0001, @@ -65,7 +57,7 @@ public: }; // This is based on QFont's resolve_mask. - int resolveMask; + int resolveMask = 0; }; QQuickIcon::QQuickIcon() diff --git a/src/quicktemplates2/qquickitemdelegate.cpp b/src/quicktemplates2/qquickitemdelegate.cpp index 145eaaf4..1ff8303a 100644 --- a/src/quicktemplates2/qquickitemdelegate.cpp +++ b/src/quicktemplates2/qquickitemdelegate.cpp @@ -64,11 +64,6 @@ QT_BEGIN_NAMESPACE \sa {Customizing ItemDelegate}, {Delegate Controls} */ -QQuickItemDelegatePrivate::QQuickItemDelegatePrivate() - : highlighted(false) -{ -} - QQuickItemDelegate::QQuickItemDelegate(QQuickItem *parent) : QQuickAbstractButton(*(new QQuickItemDelegatePrivate), parent) { diff --git a/src/quicktemplates2/qquickitemdelegate_p_p.h b/src/quicktemplates2/qquickitemdelegate_p_p.h index 9896da0c..4995f050 100644 --- a/src/quicktemplates2/qquickitemdelegate_p_p.h +++ b/src/quicktemplates2/qquickitemdelegate_p_p.h @@ -57,9 +57,7 @@ class QQuickItemDelegatePrivate : public QQuickAbstractButtonPrivate Q_DECLARE_PUBLIC(QQuickItemDelegate) public: - QQuickItemDelegatePrivate(); - - bool highlighted; + bool highlighted = false; }; QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquicklabel.cpp b/src/quicktemplates2/qquicklabel.cpp index a798d4e9..0d745d68 100644 --- a/src/quicktemplates2/qquicklabel.cpp +++ b/src/quicktemplates2/qquicklabel.cpp @@ -80,7 +80,6 @@ QT_BEGIN_NAMESPACE */ QQuickLabelPrivate::QQuickLabelPrivate() - : background(nullptr) { #if QT_CONFIG(accessibility) QAccessible::installActivationObserver(this); diff --git a/src/quicktemplates2/qquickmenu.cpp b/src/quicktemplates2/qquickmenu.cpp index 4cf18db2..702c1db6 100644 --- a/src/quicktemplates2/qquickmenu.cpp +++ b/src/quicktemplates2/qquickmenu.cpp @@ -193,15 +193,9 @@ public: }; QQuickMenuPrivate::QQuickMenuPrivate() - : cascade(shouldCascade()), - hoverTimer(0), - currentIndex(-1), - overlap(0), - contentItem(nullptr), - contentModel(nullptr), - delegate(nullptr) { Q_Q(QQuickMenu); + cascade = shouldCascade(); contentModel = new QQmlObjectModel(q); } diff --git a/src/quicktemplates2/qquickmenu_p_p.h b/src/quicktemplates2/qquickmenu_p_p.h index 7697d397..6146b960 100644 --- a/src/quicktemplates2/qquickmenu_p_p.h +++ b/src/quicktemplates2/qquickmenu_p_p.h @@ -120,16 +120,16 @@ public: static QObject *contentData_at(QQmlListProperty<QObject> *prop, int index); static void contentData_clear(QQmlListProperty<QObject> *prop); - bool cascade; - int hoverTimer; - int currentIndex; - qreal overlap; + bool cascade = false; + int hoverTimer = 0; + int currentIndex = -1; + qreal overlap = 0; QPointer<QQuickMenu> parentMenu; QPointer<QQuickMenuItem> currentItem; - QQuickItem *contentItem; // TODO: cleanup + QQuickItem *contentItem = nullptr; // TODO: cleanup QVector<QObject *> contentData; QQmlObjectModel *contentModel; - QQmlComponent *delegate; + QQmlComponent *delegate = nullptr; QString title; }; diff --git a/src/quicktemplates2/qquickmenubar.cpp b/src/quicktemplates2/qquickmenubar.cpp index 2d4c7a4f..adeb013f 100644 --- a/src/quicktemplates2/qquickmenubar.cpp +++ b/src/quicktemplates2/qquickmenubar.cpp @@ -76,14 +76,6 @@ QT_BEGIN_NAMESPACE {Focus Management in Qt Quick Controls 2} */ -QQuickMenuBarPrivate::QQuickMenuBarPrivate() - : popupMode(false), - triggering(false), - delegate(nullptr) -{ - changeTypes |= ImplicitWidth | ImplicitHeight; -} - QQuickItem *QQuickMenuBarPrivate::beginCreateItem() { Q_Q(QQuickMenuBar); @@ -294,6 +286,8 @@ void QQuickMenuBarPrivate::menus_clear(QQmlListProperty<QQuickMenu> *prop) QQuickMenuBar::QQuickMenuBar(QQuickItem *parent) : QQuickContainer(*(new QQuickMenuBarPrivate), parent) { + Q_D(QQuickMenuBar); + d->changeTypes |= QQuickItemPrivate::Geometry; setFlag(ItemIsFocusScope); setFocusPolicy(Qt::ClickFocus); } diff --git a/src/quicktemplates2/qquickmenubar_p_p.h b/src/quicktemplates2/qquickmenubar_p_p.h index e11580e2..75fbed73 100644 --- a/src/quicktemplates2/qquickmenubar_p_p.h +++ b/src/quicktemplates2/qquickmenubar_p_p.h @@ -61,8 +61,6 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickMenuBarPrivate : public QQuickConta Q_DECLARE_PUBLIC(QQuickMenuBar) public: - QQuickMenuBarPrivate(); - static QQuickMenuBarPrivate *get(QQuickMenuBar *menuBar) { return menuBar->d_func(); @@ -98,9 +96,9 @@ public: static QQuickMenu *menus_at(QQmlListProperty<QQuickMenu> *prop, int index); static void menus_clear(QQmlListProperty<QQuickMenu> *prop); - bool popupMode; - bool triggering; - QQmlComponent *delegate; + bool popupMode = false; + bool triggering = false; + QQmlComponent *delegate = nullptr; QPointer<QQuickMenuBarItem> currentItem; }; diff --git a/src/quicktemplates2/qquickmenubaritem_p_p.h b/src/quicktemplates2/qquickmenubaritem_p_p.h index bd4c3a43..a36e8949 100644 --- a/src/quicktemplates2/qquickmenubaritem_p_p.h +++ b/src/quicktemplates2/qquickmenubaritem_p_p.h @@ -61,13 +61,6 @@ class QQuickMenuBarItemPrivate : public QQuickAbstractButtonPrivate Q_DECLARE_PUBLIC(QQuickMenuBarItem) public: - QQuickMenuBarItemPrivate() - : highlighted(false), - menu(nullptr), - menuBar(nullptr) - { - } - static QQuickMenuBarItemPrivate *get(QQuickMenuBarItem *item) { return item->d_func(); @@ -75,9 +68,9 @@ public: void setMenuBar(QQuickMenuBar *menuBar); - bool highlighted; - QQuickMenu *menu; - QQuickMenuBar *menuBar; + bool highlighted = false; + QQuickMenu *menu = nullptr; + QQuickMenuBar *menuBar = nullptr; }; QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquickmenuitem.cpp b/src/quicktemplates2/qquickmenuitem.cpp index ca74dd60..bfd42634 100644 --- a/src/quicktemplates2/qquickmenuitem.cpp +++ b/src/quicktemplates2/qquickmenuitem.cpp @@ -89,14 +89,6 @@ QT_BEGIN_NAMESPACE \sa {Customizing Menu}, Menu, {Menu Controls} */ -QQuickMenuItemPrivate::QQuickMenuItemPrivate() - : highlighted(false), - arrow(nullptr), - menu(nullptr), - subMenu(nullptr) -{ -} - void QQuickMenuItemPrivate::setMenu(QQuickMenu *newMenu) { Q_Q(QQuickMenuItem); diff --git a/src/quicktemplates2/qquickmenuitem_p_p.h b/src/quicktemplates2/qquickmenuitem_p_p.h index 5deea6e3..034a199a 100644 --- a/src/quicktemplates2/qquickmenuitem_p_p.h +++ b/src/quicktemplates2/qquickmenuitem_p_p.h @@ -60,8 +60,6 @@ class QQuickMenuItemPrivate : public QQuickAbstractButtonPrivate Q_DECLARE_PUBLIC(QQuickMenuItem) public: - QQuickMenuItemPrivate(); - static QQuickMenuItemPrivate *get(QQuickMenuItem *item) { return item->d_func(); @@ -75,10 +73,10 @@ public: void cancelArrow(); void executeArrow(bool complete = false); - bool highlighted; + bool highlighted = false; QQuickDeferredPointer<QQuickItem> arrow; - QQuickMenu *menu; - QQuickMenu *subMenu; + QQuickMenu *menu = nullptr; + QQuickMenu *subMenu = nullptr; }; QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquickoverlay.cpp b/src/quicktemplates2/qquickoverlay.cpp index 4be28031..43dfa682 100644 --- a/src/quicktemplates2/qquickoverlay.cpp +++ b/src/quicktemplates2/qquickoverlay.cpp @@ -97,12 +97,6 @@ void QQuickOverlayPrivate::itemGeometryChanged(QQuickItem *, QQuickGeometryChang updateGeometry(); } -QQuickOverlayPrivate::QQuickOverlayPrivate() - : modal(nullptr), - modeless(nullptr) -{ -} - bool QQuickOverlayPrivate::startDrag(QEvent *event, const QPointF &pos) { Q_Q(QQuickOverlay); @@ -563,18 +557,11 @@ class QQuickOverlayAttachedPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QQuickOverlayAttached) public: - QQuickOverlayAttachedPrivate() - : window(nullptr), - modal(nullptr), - modeless(nullptr) - { - } - void setWindow(QQuickWindow *newWindow); - QQuickWindow *window; - QQmlComponent *modal; - QQmlComponent *modeless; + QQuickWindow *window = nullptr; + QQmlComponent *modal = nullptr; + QQmlComponent *modeless = nullptr; }; void QQuickOverlayAttachedPrivate::setWindow(QQuickWindow *newWindow) diff --git a/src/quicktemplates2/qquickoverlay_p_p.h b/src/quicktemplates2/qquickoverlay_p_p.h index a290ecc2..b445f87a 100644 --- a/src/quicktemplates2/qquickoverlay_p_p.h +++ b/src/quicktemplates2/qquickoverlay_p_p.h @@ -63,8 +63,6 @@ class QQuickOverlayPrivate : public QQuickItemPrivate, public QQuickItemChangeLi Q_DECLARE_PUBLIC(QQuickOverlay) public: - QQuickOverlayPrivate(); - static QQuickOverlayPrivate *get(QQuickOverlay *overlay) { return overlay->d_func(); @@ -91,8 +89,8 @@ public: void updateGeometry(); - QQmlComponent *modal; - QQmlComponent *modeless; + QQmlComponent *modal = nullptr; + QQmlComponent *modeless = nullptr; QVector<QQuickPopup *> allPopups; QVector<QQuickDrawer *> allDrawers; QPointer<QQuickPopup> mouseGrabberPopup; diff --git a/src/quicktemplates2/qquickpageindicator.cpp b/src/quicktemplates2/qquickpageindicator.cpp index c5c42dfb..d29158a8 100644 --- a/src/quicktemplates2/qquickpageindicator.cpp +++ b/src/quicktemplates2/qquickpageindicator.cpp @@ -88,15 +88,6 @@ class QQuickPageIndicatorPrivate : public QQuickControlPrivate Q_DECLARE_PUBLIC(QQuickPageIndicator) public: - QQuickPageIndicatorPrivate() - : count(0), - currentIndex(0), - interactive(false), - delegate(nullptr), - pressedItem(nullptr) - { - } - void handlePress(const QPointF &point) override; void handleMove(const QPointF &point) override; void handleRelease(const QPointF &point) override; @@ -108,11 +99,11 @@ public: void itemChildAdded(QQuickItem *, QQuickItem *child) override; - int count; - int currentIndex; - bool interactive; - QQmlComponent *delegate; - QQuickItem *pressedItem; + int count = 0; + int currentIndex = 0; + bool interactive = false; + QQmlComponent *delegate = nullptr; + QQuickItem *pressedItem = nullptr; }; void QQuickPageIndicatorPrivate::handlePress(const QPointF &point) diff --git a/src/quicktemplates2/qquickpane.cpp b/src/quicktemplates2/qquickpane.cpp index 72a5ee17..d923267f 100644 --- a/src/quicktemplates2/qquickpane.cpp +++ b/src/quicktemplates2/qquickpane.cpp @@ -107,15 +107,6 @@ QT_BEGIN_NAMESPACE {Focus Management in Qt Quick Controls 2} */ -QQuickPanePrivate::QQuickPanePrivate() - : hasContentWidth(false), - hasContentHeight(false), - contentWidth(0), - contentHeight(0), - firstChild(nullptr) -{ -} - void QQuickPanePrivate::init() { Q_Q(QQuickPane); diff --git a/src/quicktemplates2/qquickpane_p_p.h b/src/quicktemplates2/qquickpane_p_p.h index 808b33c6..bd89aee2 100644 --- a/src/quicktemplates2/qquickpane_p_p.h +++ b/src/quicktemplates2/qquickpane_p_p.h @@ -59,8 +59,6 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPanePrivate : public QQuickControlP Q_DECLARE_PUBLIC(QQuickPane) public: - QQuickPanePrivate(); - void init(); virtual QQmlListProperty<QObject> contentData(); @@ -80,11 +78,11 @@ public: void updateContentWidth(); void updateContentHeight(); - bool hasContentWidth; - bool hasContentHeight; - qreal contentWidth; - qreal contentHeight; - QQuickItem *firstChild; + bool hasContentWidth = false; + bool hasContentHeight = false; + qreal contentWidth = 0; + qreal contentHeight = 0; + QQuickItem *firstChild = nullptr; }; QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp index 01a546bb..2a02a6c1 100644 --- a/src/quicktemplates2/qquickpopup.cpp +++ b/src/quicktemplates2/qquickpopup.cpp @@ -247,56 +247,10 @@ QT_BEGIN_NAMESPACE \sa closed() */ -static const QQuickPopup::ClosePolicy DefaultClosePolicy = QQuickPopup::CloseOnEscape | QQuickPopup::CloseOnPressOutside; +const QQuickPopup::ClosePolicy QQuickPopupPrivate::DefaultClosePolicy = QQuickPopup::CloseOnEscape | QQuickPopup::CloseOnPressOutside; QQuickPopupPrivate::QQuickPopupPrivate() - : focus(false), - modal(false), - dim(false), - hasDim(false), - visible(false), - complete(true), - positioning(false), - hasWidth(false), - hasHeight(false), - hasTopMargin(false), - hasLeftMargin(false), - hasRightMargin(false), - hasBottomMargin(false), - allowVerticalFlip(false), - allowHorizontalFlip(false), - allowVerticalMove(true), - allowHorizontalMove(true), - allowVerticalResize(true), - allowHorizontalResize(true), - hadActiveFocusBeforeExitTransition(false), - interactive(true), - hasClosePolicy(false), - touchId(-1), - x(0), - y(0), - effectiveX(0), - effectiveY(0), - margins(-1), - topMargin(0), - leftMargin(0), - rightMargin(0), - bottomMargin(0), - transitionState(QQuickPopupPrivate::NoTransition), - closePolicy(DefaultClosePolicy), - parentItem(nullptr), - dimmer(nullptr), - window(nullptr), - enter(nullptr), - exit(nullptr), - popupItem(nullptr), - positioner(nullptr), - transitionManager(this), - anchors(nullptr) -{ -} - -QQuickPopupPrivate::~QQuickPopupPrivate() + : transitionManager(this) { } @@ -802,7 +756,7 @@ void QQuickPopupPrivate::resizeOverlay() } QQuickPopupTransitionManager::QQuickPopupTransitionManager(QQuickPopupPrivate *popup) - : QQuickTransitionManager(), popup(popup) + : popup(popup) { } @@ -860,6 +814,8 @@ QQuickPopup::~QQuickPopup() d->popupItem->ungrabShortcut(); delete d->popupItem; d->popupItem = nullptr; + delete d->positioner; + d->positioner = nullptr; } /*! @@ -2073,7 +2029,7 @@ void QQuickPopup::setClosePolicy(ClosePolicy policy) void QQuickPopup::resetClosePolicy() { Q_D(QQuickPopup); - setClosePolicy(DefaultClosePolicy); + setClosePolicy(QQuickPopupPrivate::DefaultClosePolicy); d->hasClosePolicy = false; } diff --git a/src/quicktemplates2/qquickpopup_p_p.h b/src/quicktemplates2/qquickpopup_p_p.h index 00fba84c..e32fdb28 100644 --- a/src/quicktemplates2/qquickpopup_p_p.h +++ b/src/quicktemplates2/qquickpopup_p_p.h @@ -78,7 +78,7 @@ protected: void finished() override; private: - QQuickPopupPrivate *popup; + QQuickPopupPrivate *popup = nullptr; }; class Q_AUTOTEST_EXPORT QQuickPopupPrivate : public QObjectPrivate, public QQuickItemChangeListener @@ -87,7 +87,6 @@ class Q_AUTOTEST_EXPORT QQuickPopupPrivate : public QObjectPrivate, public QQuic public: QQuickPopupPrivate(); - ~QQuickPopupPrivate(); static QQuickPopupPrivate *get(QQuickPopup *popup) { @@ -149,52 +148,54 @@ public: NoTransition, EnterTransition, ExitTransition }; - bool focus; - bool modal; - bool dim; - bool hasDim; - bool visible; - bool complete; - bool positioning; - bool hasWidth; - bool hasHeight; - bool hasTopMargin; - bool hasLeftMargin; - bool hasRightMargin; - bool hasBottomMargin; - bool allowVerticalFlip; - bool allowHorizontalFlip; - bool allowVerticalMove; - bool allowHorizontalMove; - bool allowVerticalResize; - bool allowHorizontalResize; - bool hadActiveFocusBeforeExitTransition; - bool interactive; - bool hasClosePolicy; - int touchId; - qreal x; - qreal y; - qreal effectiveX; - qreal effectiveY; - qreal margins; - qreal topMargin; - qreal leftMargin; - qreal rightMargin; - qreal bottomMargin; + static const QQuickPopup::ClosePolicy DefaultClosePolicy; + + bool focus = false; + bool modal = false; + bool dim = false; + bool hasDim = false; + bool visible = false; + bool complete = true; + bool positioning = false; + bool hasWidth = false; + bool hasHeight = false; + bool hasTopMargin = false; + bool hasLeftMargin = false; + bool hasRightMargin = false; + bool hasBottomMargin = false; + bool allowVerticalFlip = false; + bool allowHorizontalFlip = false; + bool allowVerticalMove = true; + bool allowHorizontalMove = true; + bool allowVerticalResize = true; + bool allowHorizontalResize = true; + bool hadActiveFocusBeforeExitTransition = false; + bool interactive = true; + bool hasClosePolicy = false; + int touchId = -1; + qreal x = 0; + qreal y = 0; + qreal effectiveX = 0; + qreal effectiveY = 0; + qreal margins = -1; + qreal topMargin = 0; + qreal leftMargin = 0; + qreal rightMargin = 0; + qreal bottomMargin = 0; QPointF pressPoint; - TransitionState transitionState; - QQuickPopup::ClosePolicy closePolicy; - QQuickItem *parentItem; - QQuickItem *dimmer; - QQuickWindow *window; - QQuickTransition *enter; - QQuickTransition *exit; - QQuickPopupItem *popupItem; - QQuickPopupPositioner *positioner; + TransitionState transitionState = NoTransition; + QQuickPopup::ClosePolicy closePolicy = DefaultClosePolicy; + QQuickItem *parentItem = nullptr; + QQuickItem *dimmer = nullptr; + QQuickWindow *window = nullptr; + QQuickTransition *enter = nullptr; + QQuickTransition *exit = nullptr; + QQuickPopupItem *popupItem = nullptr; + QQuickPopupPositioner *positioner = nullptr; QList<QQuickStateAction> enterActions; QList<QQuickStateAction> exitActions; QQuickPopupTransitionManager transitionManager; - QQuickPopupAnchors *anchors; + QQuickPopupAnchors *anchors = nullptr; friend class QQuickPopupTransitionManager; }; diff --git a/src/quicktemplates2/qquickpopupitem.cpp b/src/quicktemplates2/qquickpopupitem.cpp index ad9ffe51..aea0087f 100644 --- a/src/quicktemplates2/qquickpopupitem.cpp +++ b/src/quicktemplates2/qquickpopupitem.cpp @@ -68,15 +68,13 @@ public: void cancelBackground() override; void executeBackground(bool complete = false) override; - int backId; - int escapeId; - QQuickPopup *popup; + int backId = 0; + int escapeId = 0; + QQuickPopup *popup = nullptr; }; QQuickPopupItemPrivate::QQuickPopupItemPrivate(QQuickPopup *popup) - : backId(0), - escapeId(0), - popup(popup) + : popup(popup) { isTabFence = true; } diff --git a/src/quicktemplates2/qquickpopuppositioner.cpp b/src/quicktemplates2/qquickpopuppositioner.cpp index 1c2cd1c8..69a57674 100644 --- a/src/quicktemplates2/qquickpopuppositioner.cpp +++ b/src/quicktemplates2/qquickpopuppositioner.cpp @@ -53,9 +53,7 @@ static const QQuickItemPrivate::ChangeTypes ItemChangeTypes = QQuickItemPrivate: | QQuickItemPrivate::Parent; QQuickPopupPositioner::QQuickPopupPositioner(QQuickPopup *popup) - : m_positioning(false), - m_parentItem(nullptr), - m_popup(popup) + : m_popup(popup) { } @@ -279,7 +277,7 @@ void QQuickPopupPositioner::itemParentChanged(QQuickItem *, QQuickItem *parent) void QQuickPopupPositioner::itemChildRemoved(QQuickItem *item, QQuickItem *child) { - if (child->isAncestorOf(m_parentItem)) + if (child == m_parentItem || child->isAncestorOf(m_parentItem)) removeAncestorListeners(item); } diff --git a/src/quicktemplates2/qquickpopuppositioner_p_p.h b/src/quicktemplates2/qquickpopuppositioner_p_p.h index f057f57b..6eb990a7 100644 --- a/src/quicktemplates2/qquickpopuppositioner_p_p.h +++ b/src/quicktemplates2/qquickpopuppositioner_p_p.h @@ -77,9 +77,9 @@ private: void removeAncestorListeners(QQuickItem *item); void addAncestorListeners(QQuickItem *item); - bool m_positioning; - QQuickItem *m_parentItem; - QQuickPopup *m_popup; + bool m_positioning = false; + QQuickItem *m_parentItem = nullptr; + QQuickPopup *m_popup = nullptr; }; QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquickpresshandler.cpp b/src/quicktemplates2/qquickpresshandler.cpp index 8f8167cd..8df25a82 100644 --- a/src/quicktemplates2/qquickpresshandler.cpp +++ b/src/quicktemplates2/qquickpresshandler.cpp @@ -44,16 +44,6 @@ QT_BEGIN_NAMESPACE -QQuickPressHandler::QQuickPressHandler() - : control(nullptr), - longPress(false), - pressAndHoldSignalIndex(-1), - pressedSignalIndex(-1), - releasedSignalIndex(-1), - delayedMousePressEvent(nullptr) -{ -} - void QQuickPressHandler::mousePressEvent(QMouseEvent *event) { longPress = false; diff --git a/src/quicktemplates2/qquickpresshandler_p_p.h b/src/quicktemplates2/qquickpresshandler_p_p.h index 7b2c88f3..99ef94bd 100644 --- a/src/quicktemplates2/qquickpresshandler_p_p.h +++ b/src/quicktemplates2/qquickpresshandler_p_p.h @@ -59,8 +59,6 @@ class QTimerEvent; struct QQuickPressHandler { - QQuickPressHandler(); - void mousePressEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event); @@ -69,14 +67,14 @@ struct QQuickPressHandler void clearDelayedMouseEvent(); bool isActive(); - QQuickItem *control; + QQuickItem *control = nullptr; QBasicTimer timer; QPointF pressPos; - bool longPress; - int pressAndHoldSignalIndex; - int pressedSignalIndex; - int releasedSignalIndex; - QMouseEvent *delayedMousePressEvent; + bool longPress = false; + int pressAndHoldSignalIndex = -1; + int pressedSignalIndex = -1; + int releasedSignalIndex = -1; + QMouseEvent *delayedMousePressEvent = nullptr; }; QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquickprogressbar.cpp b/src/quicktemplates2/qquickprogressbar.cpp index c5a24f6c..041d4d88 100644 --- a/src/quicktemplates2/qquickprogressbar.cpp +++ b/src/quicktemplates2/qquickprogressbar.cpp @@ -89,18 +89,10 @@ QT_BEGIN_NAMESPACE class QQuickProgressBarPrivate : public QQuickControlPrivate { public: - QQuickProgressBarPrivate() - : from(0), - to(1.0), - value(0), - indeterminate(false) - { - } - - qreal from; - qreal to; - qreal value; - bool indeterminate; + qreal from = 0; + qreal to = 1; + qreal value = 0; + bool indeterminate = false; }; QQuickProgressBar::QQuickProgressBar(QQuickItem *parent) diff --git a/src/quicktemplates2/qquickrangeslider.cpp b/src/quicktemplates2/qquickrangeslider.cpp index b06cb23c..ff488dac 100644 --- a/src/quicktemplates2/qquickrangeslider.cpp +++ b/src/quicktemplates2/qquickrangeslider.cpp @@ -98,14 +98,7 @@ class QQuickRangeSliderNodePrivate : public QObjectPrivate public: QQuickRangeSliderNodePrivate(qreal value, QQuickRangeSlider *slider) : value(value), - isPendingValue(false), - pendingValue(0), - position(0), - handle(nullptr), - slider(slider), - pressed(false), - hovered(false), - touchId(-1) + slider(slider) { } @@ -119,15 +112,15 @@ public: static QQuickRangeSliderNodePrivate *get(QQuickRangeSliderNode *node); - qreal value; - bool isPendingValue; - qreal pendingValue; - qreal position; + qreal value = 0; + bool isPendingValue = false; + qreal pendingValue = 0; + qreal position = 0; QQuickDeferredPointer<QQuickItem> handle; - QQuickRangeSlider *slider; - bool pressed; - bool hovered; - int touchId; + QQuickRangeSlider *slider = nullptr; + bool pressed = false; + bool hovered = false; + int touchId = -1; }; bool QQuickRangeSliderNodePrivate::isFirst() const @@ -382,19 +375,6 @@ class QQuickRangeSliderPrivate : public QQuickControlPrivate Q_DECLARE_PUBLIC(QQuickRangeSlider) public: - QQuickRangeSliderPrivate() - : live(true), - from(defaultFrom), - to(defaultTo), - stepSize(0), - touchDragThreshold(-1), - first(nullptr), - second(nullptr), - orientation(Qt::Horizontal), - snapMode(QQuickRangeSlider::NoSnap) - { - } - QQuickRangeSliderNode *pressedNode(int touchId = -1) const; #if QT_CONFIG(quicktemplates2_multitouch) @@ -410,16 +390,16 @@ public: void itemImplicitWidthChanged(QQuickItem *item) override; void itemImplicitHeightChanged(QQuickItem *item) override; - bool live; - qreal from; - qreal to; - qreal stepSize; - qreal touchDragThreshold; - QQuickRangeSliderNode *first; - QQuickRangeSliderNode *second; + bool live = true; + qreal from = defaultFrom; + qreal to = defaultTo; + qreal stepSize = 0; + qreal touchDragThreshold = -1; + QQuickRangeSliderNode *first = nullptr; + QQuickRangeSliderNode *second = nullptr; QPointF pressPoint; - Qt::Orientation orientation; - QQuickRangeSlider::SnapMode snapMode; + Qt::Orientation orientation = Qt::Horizontal; + QQuickRangeSlider::SnapMode snapMode = QQuickRangeSlider::NoSnap; }; static qreal valueAt(const QQuickRangeSlider *slider, qreal position) diff --git a/src/quicktemplates2/qquickroundbutton.cpp b/src/quicktemplates2/qquickroundbutton.cpp index 0784de81..d930edbe 100644 --- a/src/quicktemplates2/qquickroundbutton.cpp +++ b/src/quicktemplates2/qquickroundbutton.cpp @@ -65,19 +65,11 @@ class QQuickRoundButtonPrivate : public QQuickButtonPrivate Q_DECLARE_PUBLIC(QQuickRoundButton) public: - QQuickRoundButtonPrivate(); - - qreal radius; - bool explicitRadius; - void setRadius(qreal newRadius = -1.0); -}; -QQuickRoundButtonPrivate::QQuickRoundButtonPrivate() - : radius(0), - explicitRadius(false) -{ -} + qreal radius = 0; + bool explicitRadius = false; +}; void QQuickRoundButtonPrivate::setRadius(qreal newRadius) { diff --git a/src/quicktemplates2/qquickscrollbar.cpp b/src/quicktemplates2/qquickscrollbar.cpp index 67195ba8..9e6fe684 100644 --- a/src/quicktemplates2/qquickscrollbar.cpp +++ b/src/quicktemplates2/qquickscrollbar.cpp @@ -155,23 +155,6 @@ static const QQuickItemPrivate::ChangeTypes changeTypes = QQuickItemPrivate::Geo static const QQuickItemPrivate::ChangeTypes horizontalChangeTypes = changeTypes | QQuickItemPrivate::ImplicitHeight; static const QQuickItemPrivate::ChangeTypes verticalChangeTypes = changeTypes | QQuickItemPrivate::ImplicitWidth; -QQuickScrollBarPrivate::QQuickScrollBarPrivate() - : size(0), - position(0), - stepSize(0), - offset(0), - minimumSize(0), - active(false), - pressed(false), - moving(false), - interactive(true), - explicitInteractive(false), - orientation(Qt::Vertical), - snapMode(QQuickScrollBar::NoSnap), - policy(QQuickScrollBar::AsNeeded) -{ -} - QQuickScrollBarPrivate::VisualArea QQuickScrollBarPrivate::visualArea() const { qreal visualPos = position; @@ -751,13 +734,6 @@ QAccessible::Role QQuickScrollBar::accessibleRole() const } #endif -QQuickScrollBarAttachedPrivate::QQuickScrollBarAttachedPrivate() - : flickable(nullptr), - horizontal(nullptr), - vertical(nullptr) -{ -} - void QQuickScrollBarAttachedPrivate::setFlickable(QQuickFlickable *item) { if (flickable) { diff --git a/src/quicktemplates2/qquickscrollbar_p_p.h b/src/quicktemplates2/qquickscrollbar_p_p.h index 384348b4..5c7628b9 100644 --- a/src/quicktemplates2/qquickscrollbar_p_p.h +++ b/src/quicktemplates2/qquickscrollbar_p_p.h @@ -61,8 +61,6 @@ class QQuickScrollBarPrivate : public QQuickControlPrivate Q_DECLARE_PUBLIC(QQuickScrollBar) public: - QQuickScrollBarPrivate(); - static QQuickScrollBarPrivate *get(QQuickScrollBar *bar) { return bar->d_func(); @@ -72,8 +70,8 @@ public: { VisualArea(qreal pos, qreal sz) : position(pos), size(sz) { } - qreal position; - qreal size; + qreal position = 0; + qreal size = 0; }; VisualArea visualArea() const; @@ -92,26 +90,24 @@ public: void visualAreaChange(const VisualArea &newVisualArea, const VisualArea &oldVisualArea); - qreal size; - qreal position; - qreal stepSize; - qreal offset; - qreal minimumSize; - bool active; - bool pressed; - bool moving; - bool interactive; - bool explicitInteractive; - Qt::Orientation orientation; - QQuickScrollBar::SnapMode snapMode; - QQuickScrollBar::Policy policy; + qreal size = 0; + qreal position = 0; + qreal stepSize = 0; + qreal offset = 0; + qreal minimumSize = 0; + bool active = false; + bool pressed = false; + bool moving = false; + bool interactive = true; + bool explicitInteractive = false; + Qt::Orientation orientation = Qt::Vertical; + QQuickScrollBar::SnapMode snapMode = QQuickScrollBar::NoSnap; + QQuickScrollBar::Policy policy = QQuickScrollBar::AsNeeded; }; class QQuickScrollBarAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener { public: - QQuickScrollBarAttachedPrivate(); - static QQuickScrollBarAttachedPrivate *get(QQuickScrollBarAttached *attached) { return attached->d_func(); @@ -137,9 +133,9 @@ public: void itemImplicitHeightChanged(QQuickItem *item) override; void itemDestroyed(QQuickItem *item) override; - QQuickFlickable *flickable; - QQuickScrollBar *horizontal; - QQuickScrollBar *vertical; + QQuickFlickable *flickable = nullptr; + QQuickScrollBar *horizontal = nullptr; + QQuickScrollBar *vertical = nullptr; }; QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquickscrollindicator.cpp b/src/quicktemplates2/qquickscrollindicator.cpp index 511a8311..1e411bce 100644 --- a/src/quicktemplates2/qquickscrollindicator.cpp +++ b/src/quicktemplates2/qquickscrollindicator.cpp @@ -135,32 +135,23 @@ class QQuickScrollIndicatorPrivate : public QQuickControlPrivate Q_DECLARE_PUBLIC(QQuickScrollIndicator) public: - QQuickScrollIndicatorPrivate() - : size(0), - minimumSize(0), - position(0), - active(false), - orientation(Qt::Vertical) - { - } - struct VisualArea { VisualArea(qreal pos, qreal sz) : position(pos), size(sz) { } - qreal position; - qreal size; + qreal position = 0; + qreal size = 0; }; VisualArea visualArea() const; void visualAreaChange(const VisualArea &newVisualArea, const VisualArea &oldVisualArea); void resizeContent() override; - qreal size; - qreal minimumSize; - qreal position; - bool active; - Qt::Orientation orientation; + qreal size = 0; + qreal minimumSize = 0; + qreal position = 0; + bool active = false; + Qt::Orientation orientation = Qt::Vertical; }; QQuickScrollIndicatorPrivate::VisualArea QQuickScrollIndicatorPrivate::visualArea() const @@ -427,13 +418,6 @@ qreal QQuickScrollIndicator::visualPosition() const class QQuickScrollIndicatorAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener { public: - QQuickScrollIndicatorAttachedPrivate() - : flickable(nullptr), - horizontal(nullptr), - vertical(nullptr) - { - } - void activateHorizontal(); void activateVertical(); @@ -445,9 +429,9 @@ public: void itemImplicitHeightChanged(QQuickItem *item) override; void itemDestroyed(QQuickItem *item) override; - QQuickFlickable *flickable; - QQuickScrollIndicator *horizontal; - QQuickScrollIndicator *vertical; + QQuickFlickable *flickable = nullptr; + QQuickScrollIndicator *horizontal = nullptr; + QQuickScrollIndicator *vertical = nullptr; }; void QQuickScrollIndicatorAttachedPrivate::activateHorizontal() diff --git a/src/quicktemplates2/qquickscrollview.cpp b/src/quicktemplates2/qquickscrollview.cpp index c4ca2caa..1d7ecfad 100644 --- a/src/quicktemplates2/qquickscrollview.cpp +++ b/src/quicktemplates2/qquickscrollview.cpp @@ -106,8 +106,6 @@ class QQuickScrollViewPrivate : public QQuickPanePrivate Q_DECLARE_PUBLIC(QQuickScrollView) public: - QQuickScrollViewPrivate(); - QQmlListProperty<QObject> contentData() override; QQmlListProperty<QQuickItem> contentChildren() override; QList<QQuickItem *> contentChildItems() const override; @@ -137,19 +135,10 @@ public: void itemImplicitWidthChanged(QQuickItem *item) override; - bool wasTouched; - QQuickFlickable *flickable; + bool wasTouched = false; + QQuickFlickable *flickable = nullptr; }; -QQuickScrollViewPrivate::QQuickScrollViewPrivate() - : wasTouched(false), - flickable(nullptr) -{ - contentWidth = -1; - contentHeight = -1; - wheelEnabled = true; -} - QList<QQuickItem *> QQuickScrollViewPrivate::contentChildItems() const { if (!flickable) @@ -377,8 +366,12 @@ void QQuickScrollViewPrivate::itemImplicitWidthChanged(QQuickItem *item) QQuickScrollView::QQuickScrollView(QQuickItem *parent) : QQuickPane(*(new QQuickScrollViewPrivate), parent) { - setActiveFocusOnTab(true); + Q_D(QQuickScrollView); + d->contentWidth = -1; + d->contentHeight = -1; + setFiltersChildMouseEvents(true); + setWheelEnabled(true); } /*! diff --git a/src/quicktemplates2/qquickslider.cpp b/src/quicktemplates2/qquickslider.cpp index 1e6e0c25..179dcb64 100644 --- a/src/quicktemplates2/qquickslider.cpp +++ b/src/quicktemplates2/qquickslider.cpp @@ -92,21 +92,6 @@ class QQuickSliderPrivate : public QQuickControlPrivate Q_DECLARE_PUBLIC(QQuickSlider) public: - QQuickSliderPrivate() - : from(0), - to(1), - value(0), - position(0), - stepSize(0), - touchDragThreshold(-1), // in QQuickWindowPrivate::dragOverThreshold, '-1' implies using styleHints::startDragDistance() - live(true), - pressed(false), - orientation(Qt::Horizontal), - snapMode(QQuickSlider::NoSnap), - handle(nullptr) - { - } - qreal snapPosition(qreal position) const; qreal positionAt(const QPointF &point) const; void setPosition(qreal position); @@ -123,17 +108,17 @@ public: void itemImplicitWidthChanged(QQuickItem *item) override; void itemImplicitHeightChanged(QQuickItem *item) override; - qreal from; - qreal to; - qreal value; - qreal position; - qreal stepSize; - qreal touchDragThreshold; - bool live; - bool pressed; + qreal from = 0; + qreal to = 1; + qreal value = 0; + qreal position = 0; + qreal stepSize = 0; + qreal touchDragThreshold = -1; // in QQuickWindowPrivate::dragOverThreshold, '-1' implies using styleHints::startDragDistance() + bool live = true; + bool pressed = false; QPointF pressPoint; - Qt::Orientation orientation; - QQuickSlider::SnapMode snapMode; + Qt::Orientation orientation = Qt::Horizontal; + QQuickSlider::SnapMode snapMode = QQuickSlider::NoSnap; QQuickDeferredPointer<QQuickItem> handle; }; diff --git a/src/quicktemplates2/qquickspinbox.cpp b/src/quicktemplates2/qquickspinbox.cpp index c5bde74e..46519dc7 100644 --- a/src/quicktemplates2/qquickspinbox.cpp +++ b/src/quicktemplates2/qquickspinbox.cpp @@ -108,22 +108,6 @@ class QQuickSpinBoxPrivate : public QQuickControlPrivate Q_DECLARE_PUBLIC(QQuickSpinBox) public: - QQuickSpinBoxPrivate() - : editable(false), - wrap(false), - from(0), - to(99), - value(0), - stepSize(1), - delayTimer(0), - repeatTimer(0), - up(nullptr), - down(nullptr), - validator(nullptr), - inputMethodHints(Qt::ImhDigitsOnly) - { - } - int boundValue(int value, bool wrap) const; void updateValue(); bool setValue(int value, bool wrap, bool modified); @@ -154,21 +138,21 @@ public: void itemImplicitWidthChanged(QQuickItem *item) override; void itemImplicitHeightChanged(QQuickItem *item) override; - bool editable; - bool wrap; - int from; - int to; - int value; - int stepSize; - int delayTimer; - int repeatTimer; + bool editable = false; + bool wrap = false; + int from = 0; + int to = 99; + int value = 0; + int stepSize = 1; + int delayTimer = 0; + int repeatTimer = 0; QString displayText; - QQuickSpinButton *up; - QQuickSpinButton *down; - QValidator *validator; + QQuickSpinButton *up = nullptr; + QQuickSpinButton *down = nullptr; + QValidator *validator = nullptr; mutable QJSValue textFromValue; mutable QJSValue valueFromText; - Qt::InputMethodHints inputMethodHints; + Qt::InputMethodHints inputMethodHints = Qt::ImhDigitsOnly; }; class QQuickSpinButtonPrivate : public QObjectPrivate @@ -176,13 +160,6 @@ class QQuickSpinButtonPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QQuickSpinButton) public: - QQuickSpinButtonPrivate() - : pressed(false), - hovered(false), - indicator(nullptr) - { - } - static QQuickSpinButtonPrivate *get(QQuickSpinButton *button) { return button->d_func(); @@ -191,8 +168,8 @@ public: void cancelIndicator(); void executeIndicator(bool complete = false); - bool pressed; - bool hovered; + bool pressed = false; + bool hovered = false; QQuickDeferredPointer<QQuickItem> indicator; }; diff --git a/src/quicktemplates2/qquickstackelement.cpp b/src/quicktemplates2/qquickstackelement.cpp index 887d43af..7ae5c495 100644 --- a/src/quicktemplates2/qquickstackelement.cpp +++ b/src/quicktemplates2/qquickstackelement.cpp @@ -72,18 +72,7 @@ private: }; QQuickStackElement::QQuickStackElement() - : QQuickItemViewTransitionableItem(nullptr), - index(-1), - init(false), - removal(false), - ownItem(false), - ownComponent(false), - widthValid(false), - heightValid(false), - context(nullptr), - component(nullptr), - view(nullptr), - status(QQuickStackView::Inactive) + : QQuickItemViewTransitionableItem(nullptr) { } diff --git a/src/quicktemplates2/qquickstackelement_p_p.h b/src/quicktemplates2/qquickstackelement_p_p.h index 2308f47d..65e73244 100644 --- a/src/quicktemplates2/qquickstackelement_p_p.h +++ b/src/quicktemplates2/qquickstackelement_p_p.h @@ -85,18 +85,18 @@ public: void itemDestroyed(QQuickItem *item) override; - int index; - bool init; - bool removal; - bool ownItem; - bool ownComponent; - bool widthValid; - bool heightValid; - QQmlContext *context; - QQmlComponent *component; - QQuickStackView *view; + int index = -1; + bool init = false; + bool removal = false; + bool ownItem = false; + bool ownComponent = false; + bool widthValid = false; + bool heightValid = false; + QQmlContext *context = nullptr; + QQmlComponent *component = nullptr; + QQuickStackView *view = nullptr; QPointer<QQuickItem> originalParent; - QQuickStackView::Status status; + QQuickStackView::Status status = QQuickStackView::Inactive; QV4::PersistentValue properties; QV4::PersistentValue qmlCallingContext; }; diff --git a/src/quicktemplates2/qquickstacktransition.cpp b/src/quicktemplates2/qquickstacktransition.cpp index 058359c3..a0192d1b 100644 --- a/src/quicktemplates2/qquickstacktransition.cpp +++ b/src/quicktemplates2/qquickstacktransition.cpp @@ -44,23 +44,18 @@ static QQuickStackTransition exitTransition(QQuickStackView::Operation operation { QQuickStackTransition st; st.status = QQuickStackView::Deactivating; - st.transition = nullptr; st.element = element; const QQuickItemViewTransitioner *transitioner = QQuickStackViewPrivate::get(view)->transitioner; switch (operation) { case QQuickStackView::PushTransition: - st.target = false; st.type = QQuickItemViewTransitioner::AddTransition; - st.viewBounds = QRectF(); if (transitioner) st.transition = transitioner->addDisplacedTransition; break; case QQuickStackView::ReplaceTransition: - st.target = false; st.type = QQuickItemViewTransitioner::MoveTransition; - st.viewBounds = QRectF(); if (transitioner) st.transition = transitioner->moveDisplacedTransition; break; @@ -83,7 +78,6 @@ static QQuickStackTransition enterTransition(QQuickStackView::Operation operatio { QQuickStackTransition st; st.status = QQuickStackView::Activating; - st.transition = nullptr; st.element = element; const QQuickItemViewTransitioner *transitioner = QQuickStackViewPrivate::get(view)->transitioner; @@ -104,9 +98,7 @@ static QQuickStackTransition enterTransition(QQuickStackView::Operation operatio st.transition = transitioner->moveTransition; break; case QQuickStackView::PopTransition: - st.target = false; st.type = QQuickItemViewTransitioner::RemoveTransition; - st.viewBounds = QRectF(); if (transitioner) st.transition = transitioner->removeDisplacedTransition; break; diff --git a/src/quicktemplates2/qquickstacktransition_p_p.h b/src/quicktemplates2/qquickstacktransition_p_p.h index 7101420c..3a08fb4a 100644 --- a/src/quicktemplates2/qquickstacktransition_p_p.h +++ b/src/quicktemplates2/qquickstacktransition_p_p.h @@ -66,12 +66,12 @@ struct QQuickStackTransition static QQuickStackTransition replaceExit(QQuickStackView::Operation operation, QQuickStackElement *element, QQuickStackView *view); static QQuickStackTransition replaceEnter(QQuickStackView::Operation operation, QQuickStackElement *element, QQuickStackView *view); - bool target; - QQuickStackView::Status status; - QQuickItemViewTransitioner::TransitionType type; + bool target = false; + QQuickStackView::Status status = QQuickStackView::Inactive; + QQuickItemViewTransitioner::TransitionType type = QQuickItemViewTransitioner::NoTransition; QRectF viewBounds; - QQuickStackElement *element; - QQuickTransition *transition; + QQuickStackElement *element = nullptr; + QQuickTransition *transition = nullptr; }; QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquickstackview_p.cpp b/src/quicktemplates2/qquickstackview_p.cpp index 606d259a..e0e1d9ef 100644 --- a/src/quicktemplates2/qquickstackview_p.cpp +++ b/src/quicktemplates2/qquickstackview_p.cpp @@ -47,13 +47,6 @@ QT_BEGIN_NAMESPACE -QQuickStackViewPrivate::QQuickStackViewPrivate() - : busy(false), - currentItem(nullptr), - transitioner(nullptr) -{ -} - void QQuickStackViewPrivate::warn(const QString &error) { Q_Q(QQuickStackView); diff --git a/src/quicktemplates2/qquickstackview_p_p.h b/src/quicktemplates2/qquickstackview_p_p.h index 7f1b77b1..74ea3e7a 100644 --- a/src/quicktemplates2/qquickstackview_p_p.h +++ b/src/quicktemplates2/qquickstackview_p_p.h @@ -66,8 +66,6 @@ class QQuickStackViewPrivate : public QQuickControlPrivate, public QQuickItemVie Q_DECLARE_PUBLIC(QQuickStackView) public: - QQuickStackViewPrivate(); - static QQuickStackViewPrivate *get(QQuickStackView *view) { return view->d_func(); @@ -94,14 +92,14 @@ public: void setBusy(bool busy); void depthChange(int newDepth, int oldDepth); - bool busy; + bool busy = false; QString operation; QJSValue initialItem; - QQuickItem *currentItem; + QQuickItem *currentItem = nullptr; QSet<QQuickStackElement*> removing; QList<QQuickStackElement*> removed; QStack<QQuickStackElement *> elements; - QQuickItemViewTransitioner *transitioner; + QQuickItemViewTransitioner *transitioner = nullptr; }; class QQuickStackViewAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener @@ -109,12 +107,6 @@ class QQuickStackViewAttachedPrivate : public QObjectPrivate, public QQuickItemC Q_DECLARE_PUBLIC(QQuickStackViewAttached) public: - QQuickStackViewAttachedPrivate() - : explicitVisible(false), - element(nullptr) - { - } - static QQuickStackViewAttachedPrivate *get(QQuickStackViewAttached *attached) { return attached->d_func(); @@ -122,8 +114,8 @@ public: void itemParentChanged(QQuickItem *item, QQuickItem *parent); - bool explicitVisible; - QQuickStackElement *element; + bool explicitVisible = false; + QQuickStackElement *element = nullptr; }; QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquickswipedelegate.cpp b/src/quicktemplates2/qquickswipedelegate.cpp index ed6da9dc..b4c1c18e 100644 --- a/src/quicktemplates2/qquickswipedelegate.cpp +++ b/src/quicktemplates2/qquickswipedelegate.cpp @@ -127,7 +127,7 @@ protected: void finished() override; private: - QQuickSwipe *m_swipe; + QQuickSwipe *m_swipe = nullptr; }; class QQuickSwipePrivate : public QObjectPrivate @@ -135,23 +135,7 @@ class QQuickSwipePrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QQuickSwipe) public: - QQuickSwipePrivate(QQuickSwipeDelegate *control) - : control(control), - positionBeforePress(0), - position(0), - wasComplete(false), - complete(false), - enabled(true), - left(nullptr), - behind(nullptr), - right(nullptr), - leftItem(nullptr), - behindItem(nullptr), - rightItem(nullptr), - transition(nullptr), - transitionManager(nullptr) - { - } + QQuickSwipePrivate(QQuickSwipeDelegate *control) : control(control) { } static QQuickSwipePrivate *get(QQuickSwipe *swipe); @@ -175,24 +159,24 @@ public: void beginTransition(qreal position); void finishTransition(); - QQuickSwipeDelegate *control; + QQuickSwipeDelegate *control = nullptr; // Same range as position, but is set before press events so that we can // keep track of which direction the user must swipe when using left and right delegates. - qreal positionBeforePress; - qreal position; + qreal positionBeforePress = 0; + qreal position = 0; // A "less strict" version of complete that is true if complete was true // before the last press event. - bool wasComplete; - bool complete; - bool enabled; + bool wasComplete = false; + bool complete = false; + bool enabled = true; QQuickVelocityCalculator velocityCalculator; - QQmlComponent *left; - QQmlComponent *behind; - QQmlComponent *right; - QQuickItem *leftItem; - QQuickItem *behindItem; - QQuickItem *rightItem; - QQuickTransition *transition; + QQmlComponent *left = nullptr; + QQmlComponent *behind = nullptr; + QQmlComponent *right = nullptr; + QQuickItem *leftItem = nullptr; + QQuickItem *behindItem = nullptr; + QQuickItem *rightItem = nullptr; + QQuickTransition *transition = nullptr; QScopedPointer<QQuickSwipeTransitionManager> transitionManager; }; @@ -1257,10 +1241,8 @@ class QQuickSwipeDelegateAttachedPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QQuickSwipeDelegateAttached) public: - QQuickSwipeDelegateAttachedPrivate() : pressed(false) { } - // True when left/right/behind is non-interactive and is pressed. - bool pressed; + bool pressed = false; }; /*! diff --git a/src/quicktemplates2/qquickswipeview.cpp b/src/quicktemplates2/qquickswipeview.cpp index 0f3b6851..f887be7b 100644 --- a/src/quicktemplates2/qquickswipeview.cpp +++ b/src/quicktemplates2/qquickswipeview.cpp @@ -108,13 +108,6 @@ class QQuickSwipeViewPrivate : public QQuickContainerPrivate Q_DECLARE_PUBLIC(QQuickSwipeView) public: - QQuickSwipeViewPrivate() - : interactive(true), - orientation(Qt::Horizontal) - { - changeTypes |= ImplicitWidth | ImplicitHeight; - } - void resizeItem(QQuickItem *item); void resizeItems(); @@ -126,8 +119,8 @@ public: qreal getContentWidth() const override; qreal getContentHeight() const override; - bool interactive; - Qt::Orientation orientation; + bool interactive = true; + Qt::Orientation orientation = Qt::Horizontal; }; class QQuickSwipeViewAttachedPrivate : public QObjectPrivate @@ -135,13 +128,6 @@ class QQuickSwipeViewAttachedPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QQuickSwipeViewAttached) public: - QQuickSwipeViewAttachedPrivate() - : swipeView(nullptr), - index(-1), - currentIndex(-1) - { - } - static QQuickSwipeViewAttachedPrivate *get(QQuickSwipeViewAttached *attached) { return attached->d_func(); @@ -151,9 +137,9 @@ public: void updateCurrentIndex(); void setCurrentIndex(int i); - QQuickSwipeView *swipeView; - int index; - int currentIndex; + QQuickSwipeView *swipeView = nullptr; + int index = -1; + int currentIndex = -1; }; void QQuickSwipeViewPrivate::resizeItems() @@ -218,6 +204,7 @@ QQuickSwipeView::QQuickSwipeView(QQuickItem *parent) : QQuickContainer(*(new QQuickSwipeViewPrivate), parent) { Q_D(QQuickSwipeView); + d->changeTypes |= QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight; setFlag(ItemIsFocusScope); setActiveFocusOnTab(true); QObjectPrivate::connect(this, &QQuickContainer::currentItemChanged, d, &QQuickControlPrivate::updateImplicitContentSize); diff --git a/src/quicktemplates2/qquickswitch.cpp b/src/quicktemplates2/qquickswitch.cpp index 3093b334..55e53246 100644 --- a/src/quicktemplates2/qquickswitch.cpp +++ b/src/quicktemplates2/qquickswitch.cpp @@ -82,15 +82,13 @@ class QQuickSwitchPrivate : public QQuickAbstractButtonPrivate Q_DECLARE_PUBLIC(QQuickSwitch) public: - QQuickSwitchPrivate() : position(0) { } - qreal positionAt(const QPointF &point) const; bool canDrag(const QPointF &movePoint) const; void handleMove(const QPointF &point) override; void handleRelease(const QPointF &point) override; - qreal position; + qreal position = 0; }; qreal QQuickSwitchPrivate::positionAt(const QPointF &point) const diff --git a/src/quicktemplates2/qquickswitchdelegate.cpp b/src/quicktemplates2/qquickswitchdelegate.cpp index 3ba859f5..765525fb 100644 --- a/src/quicktemplates2/qquickswitchdelegate.cpp +++ b/src/quicktemplates2/qquickswitchdelegate.cpp @@ -79,15 +79,13 @@ class QQuickSwitchDelegatePrivate : public QQuickItemDelegatePrivate Q_DECLARE_PUBLIC(QQuickSwitchDelegate) public: - QQuickSwitchDelegatePrivate() : position(0) { } - qreal positionAt(const QPointF &point) const; bool canDrag(const QPointF &movePoint) const; void handleMove(const QPointF &point) override; void handleRelease(const QPointF &point) override; - qreal position; + qreal position = 0; }; qreal QQuickSwitchDelegatePrivate::positionAt(const QPointF &point) const diff --git a/src/quicktemplates2/qquicktabbar.cpp b/src/quicktemplates2/qquicktabbar.cpp index 3873ecfa..1db04ba0 100644 --- a/src/quicktemplates2/qquicktabbar.cpp +++ b/src/quicktemplates2/qquicktabbar.cpp @@ -100,8 +100,6 @@ class QQuickTabBarPrivate : public QQuickContainerPrivate Q_DECLARE_PUBLIC(QQuickTabBar) public: - QQuickTabBarPrivate(); - void updateCurrentItem(); void updateCurrentIndex(); void updateLayout(); @@ -113,8 +111,8 @@ public: void itemImplicitWidthChanged(QQuickItem *item) override; void itemImplicitHeightChanged(QQuickItem *item) override; - bool updatingLayout; - QQuickTabBar::Position position; + bool updatingLayout = false; + QQuickTabBar::Position position = QQuickTabBar::Header; }; class QQuickTabBarAttachedPrivate : public QObjectPrivate @@ -122,12 +120,6 @@ class QQuickTabBarAttachedPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QQuickTabBarAttached) public: - QQuickTabBarAttachedPrivate() - : index(-1), - tabBar(nullptr) - { - } - static QQuickTabBarAttachedPrivate *get(QQuickTabBarAttached *attached) { return attached->d_func(); @@ -135,17 +127,10 @@ public: void update(QQuickTabBar *tabBar, int index); - int index; - QQuickTabBar *tabBar; + int index = -1; + QQuickTabBar *tabBar = nullptr; }; -QQuickTabBarPrivate::QQuickTabBarPrivate() - : updatingLayout(false), - position(QQuickTabBar::Header) -{ - changeTypes |= Geometry | ImplicitWidth | ImplicitHeight; -} - void QQuickTabBarPrivate::updateCurrentItem() { QQuickTabButton *button = qobject_cast<QQuickTabButton *>(contentModel->get(currentIndex)); @@ -265,6 +250,7 @@ QQuickTabBar::QQuickTabBar(QQuickItem *parent) : QQuickContainer(*(new QQuickTabBarPrivate), parent) { Q_D(QQuickTabBar); + d->changeTypes |= QQuickItemPrivate::Geometry | QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight; setFlag(ItemIsFocusScope); QObjectPrivate::connect(this, &QQuickTabBar::currentIndexChanged, d, &QQuickTabBarPrivate::updateCurrentItem); } diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp index 46619342..5e633a33 100644 --- a/src/quicktemplates2/qquicktextarea.cpp +++ b/src/quicktemplates2/qquicktextarea.cpp @@ -132,14 +132,6 @@ QT_BEGIN_NAMESPACE */ QQuickTextAreaPrivate::QQuickTextAreaPrivate() - : QQuickTextEditPrivate(), -#if QT_CONFIG(quicktemplates2_hover) - hovered(false), - explicitHoverEnabled(false), -#endif - background(nullptr), - focusReason(Qt::OtherFocusReason), - flickable(nullptr) { #if QT_CONFIG(accessibility) QAccessible::installActivationObserver(this); @@ -1160,9 +1152,7 @@ void QQuickTextArea::timerEvent(QTimerEvent *event) class QQuickTextAreaAttachedPrivate : public QObjectPrivate { public: - QQuickTextAreaAttachedPrivate() : control(nullptr) { } - - QQuickTextArea *control; + QQuickTextArea *control = nullptr; }; QQuickTextAreaAttached::QQuickTextAreaAttached(QObject *parent) diff --git a/src/quicktemplates2/qquicktextarea_p_p.h b/src/quicktemplates2/qquicktextarea_p_p.h index 408cc391..613551e4 100644 --- a/src/quicktemplates2/qquicktextarea_p_p.h +++ b/src/quicktemplates2/qquicktextarea_p_p.h @@ -144,8 +144,8 @@ public: void itemDestroyed(QQuickItem *item) override; #if QT_CONFIG(quicktemplates2_hover) - bool hovered; - bool explicitHoverEnabled; + bool hovered = false; + bool explicitHoverEnabled = false; #endif struct ExtraData { @@ -169,9 +169,9 @@ public: QQuickDeferredPointer<QQuickItem> background; QString placeholder; QColor placeholderColor; - Qt::FocusReason focusReason; + Qt::FocusReason focusReason = Qt::OtherFocusReason; QQuickPressHandler pressHandler; - QQuickFlickable *flickable; + QQuickFlickable *flickable = nullptr; }; QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquicktextfield.cpp b/src/quicktemplates2/qquicktextfield.cpp index df297936..2882edca 100644 --- a/src/quicktemplates2/qquicktextfield.cpp +++ b/src/quicktemplates2/qquicktextfield.cpp @@ -113,13 +113,6 @@ QT_BEGIN_NAMESPACE */ QQuickTextFieldPrivate::QQuickTextFieldPrivate() - : QQuickTextInputPrivate(), -#if QT_CONFIG(quicktemplates2_hover) - hovered(false), - explicitHoverEnabled(false), -#endif - background(nullptr), - focusReason(Qt::OtherFocusReason) { #if QT_CONFIG(accessibility) QAccessible::installActivationObserver(this); diff --git a/src/quicktemplates2/qquicktextfield_p_p.h b/src/quicktemplates2/qquicktextfield_p_p.h index f4a8983d..3389d3dc 100644 --- a/src/quicktemplates2/qquicktextfield_p_p.h +++ b/src/quicktemplates2/qquicktextfield_p_p.h @@ -134,8 +134,8 @@ public: void itemDestroyed(QQuickItem *item) override; #if QT_CONFIG(quicktemplates2_hover) - bool hovered; - bool explicitHoverEnabled; + bool hovered = false; + bool explicitHoverEnabled = false; #endif struct ExtraData { @@ -159,7 +159,7 @@ public: QQuickDeferredPointer<QQuickItem> background; QString placeholder; QColor placeholderColor; - Qt::FocusReason focusReason; + Qt::FocusReason focusReason = Qt::OtherFocusReason; QQuickPressHandler pressHandler; }; diff --git a/src/quicktemplates2/qquicktoolbar.cpp b/src/quicktemplates2/qquicktoolbar.cpp index c597de74..d554c098 100644 --- a/src/quicktemplates2/qquicktoolbar.cpp +++ b/src/quicktemplates2/qquicktoolbar.cpp @@ -99,9 +99,7 @@ QT_BEGIN_NAMESPACE class QQuickToolBarPrivate : public QQuickPanePrivate { public: - QQuickToolBarPrivate() : position(QQuickToolBar::Header) { } - - QQuickToolBar::Position position; + QQuickToolBar::Position position = QQuickToolBar::Header; }; QQuickToolBar::QQuickToolBar(QQuickItem *parent) diff --git a/src/quicktemplates2/qquicktoolseparator.cpp b/src/quicktemplates2/qquicktoolseparator.cpp index 2343c7ce..9b8bd678 100644 --- a/src/quicktemplates2/qquicktoolseparator.cpp +++ b/src/quicktemplates2/qquicktoolseparator.cpp @@ -66,9 +66,7 @@ class QQuickToolSeparatorPrivate : public QQuickControlPrivate Q_DECLARE_PUBLIC(QQuickToolSeparator) public: - QQuickToolSeparatorPrivate() : orientation(Qt::Vertical) { } - - Qt::Orientation orientation; + Qt::Orientation orientation = Qt::Vertical; }; QQuickToolSeparator::QQuickToolSeparator(QQuickItem *parent) diff --git a/src/quicktemplates2/qquicktooltip.cpp b/src/quicktemplates2/qquicktooltip.cpp index 66fe9afe..c62c063d 100644 --- a/src/quicktemplates2/qquicktooltip.cpp +++ b/src/quicktemplates2/qquicktooltip.cpp @@ -124,20 +124,14 @@ class QQuickToolTipPrivate : public QQuickPopupPrivate Q_DECLARE_PUBLIC(QQuickToolTip) public: - QQuickToolTipPrivate() - : delay(0), - timeout(-1) - { - } - void startDelay(); void stopDelay(); void startTimeout(); void stopTimeout(); - int delay; - int timeout; + int delay = 0; + int timeout = -1; QString text; QBasicTimer delayTimer; QBasicTimer timeoutTimer; @@ -360,16 +354,10 @@ class QQuickToolTipAttachedPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QQuickToolTipAttached) public: - QQuickToolTipAttachedPrivate() - : delay(0), - timeout(-1) - { - } - QQuickToolTip *instance(bool create) const; - int delay; - int timeout; + int delay = 0; + int timeout = -1; QString text; }; diff --git a/src/quicktemplates2/qquicktumbler.cpp b/src/quicktemplates2/qquicktumbler.cpp index a40330a3..ee4f161a 100644 --- a/src/quicktemplates2/qquicktumbler.cpp +++ b/src/quicktemplates2/qquicktumbler.cpp @@ -87,27 +87,6 @@ QT_BEGIN_NAMESPACE \sa {Customizing Tumbler}, {Input Controls} */ -QQuickTumblerPrivate::QQuickTumblerPrivate() - : delegate(nullptr), - visibleItemCount(5), - wrap(true), - explicitWrap(false), - ignoreWrapChanges(false), - view(nullptr), - viewContentItem(nullptr), - viewContentItemType(UnsupportedContentItemType), - currentIndex(-1), - pendingCurrentIndex(-1), - ignoreCurrentIndexChanges(false), - count(0), - ignoreSignals(false) -{ -} - -QQuickTumblerPrivate::~QQuickTumblerPrivate() -{ -} - namespace { static inline qreal delegateHeight(const QQuickTumbler *tumbler) { @@ -839,13 +818,6 @@ QPalette QQuickTumbler::defaultPalette() const return QQuickTheme::themePalette(QQuickTheme::Tumbler); } -QQuickTumblerAttachedPrivate::QQuickTumblerAttachedPrivate() - : tumbler(nullptr), - index(-1), - displacement(0) -{ -} - void QQuickTumblerAttachedPrivate::init(QQuickItem *delegateItem) { if (!delegateItem->parentItem()) { diff --git a/src/quicktemplates2/qquicktumbler_p_p.h b/src/quicktemplates2/qquicktumbler_p_p.h index 24589486..4d4c3bcf 100644 --- a/src/quicktemplates2/qquicktumbler_p_p.h +++ b/src/quicktemplates2/qquicktumbler_p_p.h @@ -58,9 +58,6 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTumblerPrivate : public QQuickContr Q_DECLARE_PUBLIC(QQuickTumbler) public: - QQuickTumblerPrivate(); - ~QQuickTumblerPrivate(); - enum ContentItemType { NoContentItem, UnsupportedContentItemType, @@ -75,23 +72,23 @@ public: static QQuickTumblerPrivate *get(QQuickTumbler *tumbler); QVariant model; - QQmlComponent *delegate; - int visibleItemCount; - bool wrap; - bool explicitWrap; - bool ignoreWrapChanges; - QQuickItem *view; - QQuickItem *viewContentItem; - ContentItemType viewContentItemType; + QQmlComponent *delegate = nullptr; + int visibleItemCount = 5; + bool wrap = true; + bool explicitWrap = false; + bool ignoreWrapChanges = false; + QQuickItem *view = nullptr; + QQuickItem *viewContentItem = nullptr; + ContentItemType viewContentItemType = UnsupportedContentItemType; union { qreal viewOffset; // PathView qreal viewContentY; // ListView }; - int currentIndex; - int pendingCurrentIndex; - bool ignoreCurrentIndexChanges; - int count; - bool ignoreSignals; + int currentIndex = -1; + int pendingCurrentIndex = -1; + bool ignoreCurrentIndexChanges = false; + int count = 0; + bool ignoreSignals = false; void _q_updateItemHeights(); void _q_updateItemWidths(); @@ -123,8 +120,6 @@ class QQuickTumblerAttachedPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QQuickTumblerAttached) public: - QQuickTumblerAttachedPrivate(); - static QQuickTumblerAttachedPrivate *get(QQuickTumblerAttached *attached) { return attached->d_func(); @@ -138,9 +133,9 @@ public: // The Tumbler that contains the delegate. Required to calculated the displacement. QPointer<QQuickTumbler> tumbler; // The index of the delegate. Used to calculate the displacement. - int index; + int index = -1; // The displacement for our delegate. - qreal displacement; + qreal displacement = 0; }; QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquickvelocitycalculator.cpp b/src/quicktemplates2/qquickvelocitycalculator.cpp index b98eeff9..a0c5ec0d 100644 --- a/src/quicktemplates2/qquickvelocitycalculator.cpp +++ b/src/quicktemplates2/qquickvelocitycalculator.cpp @@ -58,12 +58,6 @@ QT_BEGIN_NAMESPACE doSomethingElse(); */ -QQuickVelocityCalculator::QQuickVelocityCalculator() - : m_point1Timestamp(0), - m_point2Timestamp(0) -{ -} - void QQuickVelocityCalculator::startMeasuring(const QPointF &point1, qint64 timestamp) { m_point1 = point1; diff --git a/src/quicktemplates2/qquickvelocitycalculator_p_p.h b/src/quicktemplates2/qquickvelocitycalculator_p_p.h index 144fe429..2b13ff07 100644 --- a/src/quicktemplates2/qquickvelocitycalculator_p_p.h +++ b/src/quicktemplates2/qquickvelocitycalculator_p_p.h @@ -56,8 +56,6 @@ QT_BEGIN_NAMESPACE class QQuickVelocityCalculator { public: - QQuickVelocityCalculator(); - void startMeasuring(const QPointF &point1, qint64 timestamp = 0); void stopMeasuring(const QPointF &m_point2, qint64 timestamp = 0); void reset(); @@ -66,8 +64,8 @@ public: private: QPointF m_point1; QPointF m_point2; - qint64 m_point1Timestamp; - qint64 m_point2Timestamp; + qint64 m_point1Timestamp = 0; + qint64 m_point2Timestamp = 0; // When a timestamp isn't available, we must use a timer. // When stopMeasuring() has been called, we store the elapsed time in point2timestamp. QElapsedTimer m_timer; |