aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickabstractbutton_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/qquickabstractbutton_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/qquickabstractbutton_p_p.h')
-rw-r--r--src/quicktemplates2/qquickabstractbutton_p_p.h46
1 files changed, 24 insertions, 22 deletions
diff --git a/src/quicktemplates2/qquickabstractbutton_p_p.h b/src/quicktemplates2/qquickabstractbutton_p_p.h
index bb74e143..1b3b59ba 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();
@@ -105,34 +103,38 @@ public:
void cancelIndicator();
void executeIndicator(bool complete = false);
- 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;
};