aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickscrollbar_p_p.h
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2018-05-03 11:23:56 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2018-05-04 12:53:00 +0000
commitaea55d29d2555c5649c13d3bc11bde4799c6bac5 (patch)
tree52434edff3041005f98b6899566fce119855efae /src/quicktemplates2/qquickscrollbar_p_p.h
parenta5d2731b1ec56580a79784759307d3b3c21ab87f (diff)
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 <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickscrollbar_p_p.h')
-rw-r--r--src/quicktemplates2/qquickscrollbar_p_p.h40
1 files changed, 18 insertions, 22 deletions
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