aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquicktumbler_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/qquicktumbler_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/qquicktumbler_p_p.h')
-rw-r--r--src/quicktemplates2/qquicktumbler_p_p.h35
1 files changed, 15 insertions, 20 deletions
diff --git a/src/quicktemplates2/qquicktumbler_p_p.h b/src/quicktemplates2/qquicktumbler_p_p.h
index 75b1a396..7f824482 100644
--- a/src/quicktemplates2/qquicktumbler_p_p.h
+++ b/src/quicktemplates2/qquicktumbler_p_p.h
@@ -59,9 +59,6 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTumblerPrivate : public QQuickContr
Q_DECLARE_PUBLIC(QQuickTumbler)
public:
- QQuickTumblerPrivate();
- ~QQuickTumblerPrivate();
-
enum ContentItemType {
NoContentItem,
UnsupportedContentItemType,
@@ -76,23 +73,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