From aea55d29d2555c5649c13d3bc11bde4799c6bac5 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 3 May 2018 11:23:56 +0200 Subject: Templates: use C++11 default member initialization The code is more readable and less error-prone (this patch caught a few uninitialized members) when the members are initialized in the same place where they are declared. In many cases, empty default destructors can be entirely removed, and we get faster implicitly declared inline default constructors defined by the compiler. Change-Id: I14c5448afc901f9b2ac5965f28c1c26c0b646c08 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickpopup_p_p.h | 91 ++++++++++++++++++----------------- 1 file changed, 46 insertions(+), 45 deletions(-) (limited to 'src/quicktemplates2/qquickpopup_p_p.h') diff --git a/src/quicktemplates2/qquickpopup_p_p.h b/src/quicktemplates2/qquickpopup_p_p.h index 6890fdac..318ae598 100644 --- a/src/quicktemplates2/qquickpopup_p_p.h +++ b/src/quicktemplates2/qquickpopup_p_p.h @@ -77,7 +77,7 @@ protected: void finished() override; private: - QQuickPopupPrivate *popup; + QQuickPopupPrivate *popup = nullptr; }; class Q_AUTOTEST_EXPORT QQuickPopupPrivate : public QObjectPrivate, public QQuickItemChangeListener @@ -86,7 +86,6 @@ class Q_AUTOTEST_EXPORT QQuickPopupPrivate : public QObjectPrivate, public QQuic public: QQuickPopupPrivate(); - ~QQuickPopupPrivate(); static QQuickPopupPrivate *get(QQuickPopup *popup) { @@ -142,50 +141,52 @@ 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; - qreal contentWidth; - qreal contentHeight; + 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; + qreal contentWidth = 0; + qreal contentHeight = 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 enterActions; QList exitActions; QQuickPopupTransitionManager transitionManager; -- cgit v1.2.3