diff options
author | Mitch Curtis <mitch.curtis@theqtcompany.com> | 2016-03-02 10:57:13 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-04-23 13:23:50 +0000 |
commit | dfc9a12fc070dc36c67960dfc56d47c6656316ec (patch) | |
tree | 5a22a1927049a38f164a533546fbc8edd6bec854 /src/quicktemplates2 | |
parent | 5c91ac2aa6509b8c7508cfddcee2b8c6e20d7429 (diff) |
Move autoRepeat out of QQuickAbstractButton
Subclasses like QQuickCheckBox don't need this.
Change-Id: I885442b3286b0a497ba742d4dc7df0e89f8b02e8
Task-number: QTBUG-51554
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r-- | src/quicktemplates2/qquickabstractbutton.cpp | 14 | ||||
-rw-r--r-- | src/quicktemplates2/qquickabstractbutton_p.h | 3 | ||||
-rw-r--r-- | src/quicktemplates2/qquickbutton.cpp | 14 | ||||
-rw-r--r-- | src/quicktemplates2/qquickbutton_p.h | 3 | ||||
-rw-r--r-- | src/quicktemplates2/qquickswipedelegate.cpp | 4 |
5 files changed, 24 insertions, 14 deletions
diff --git a/src/quicktemplates2/qquickabstractbutton.cpp b/src/quicktemplates2/qquickabstractbutton.cpp index 8ae5ca6d..5ab6729f 100644 --- a/src/quicktemplates2/qquickabstractbutton.cpp +++ b/src/quicktemplates2/qquickabstractbutton.cpp @@ -427,14 +427,6 @@ void QQuickAbstractButton::setAutoExclusive(bool exclusive) emit autoExclusiveChanged(); } -/*! - \qmlproperty bool QtQuick.Controls::AbstractButton::autoRepeat - - This property holds whether the button repeats pressed(), released() - and clicked() signals while the button is pressed and held down. - - The default value is \c false. -*/ bool QQuickAbstractButton::autoRepeat() const { Q_D(const QQuickAbstractButton); @@ -449,7 +441,7 @@ void QQuickAbstractButton::setAutoRepeat(bool repeat) d->stopPressRepeat(); d->autoRepeat = repeat; - emit autoRepeatChanged(); + autoRepeatChange(); } /*! @@ -644,6 +636,10 @@ void QQuickAbstractButton::checkableChange() { } +void QQuickAbstractButton::autoRepeatChange() +{ +} + #ifndef QT_NO_ACCESSIBILITY void QQuickAbstractButton::accessibilityActiveChanged(bool active) { diff --git a/src/quicktemplates2/qquickabstractbutton_p.h b/src/quicktemplates2/qquickabstractbutton_p.h index c8e6931f..ca48c7e8 100644 --- a/src/quicktemplates2/qquickabstractbutton_p.h +++ b/src/quicktemplates2/qquickabstractbutton_p.h @@ -63,7 +63,6 @@ class Q_QUICKTEMPLATES2_EXPORT QQuickAbstractButton : public QQuickControl Q_PROPERTY(bool checked READ isChecked WRITE setChecked NOTIFY checkedChanged FINAL) Q_PROPERTY(bool highlighted READ isHighlighted WRITE setHighlighted NOTIFY highlightedChanged FINAL) Q_PROPERTY(bool autoExclusive READ autoExclusive WRITE setAutoExclusive NOTIFY autoExclusiveChanged FINAL) - Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat NOTIFY autoRepeatChanged FINAL) Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL) public: @@ -114,7 +113,6 @@ Q_SIGNALS: void checkedChanged(); void highlightedChanged(); void autoExclusiveChanged(); - void autoRepeatChanged(); void indicatorChanged(); protected: @@ -134,6 +132,7 @@ protected: virtual void nextCheckState(); virtual void checkableChange(); + virtual void autoRepeatChange(); #ifndef QT_NO_ACCESSIBILITY void accessibilityActiveChanged(bool active) override; diff --git a/src/quicktemplates2/qquickbutton.cpp b/src/quicktemplates2/qquickbutton.cpp index f34a5295..5f702818 100644 --- a/src/quicktemplates2/qquickbutton.cpp +++ b/src/quicktemplates2/qquickbutton.cpp @@ -105,6 +105,20 @@ void QQuickButton::checkableChange() emit checkableChanged(); } +/*! + \qmlproperty bool QtQuick.Controls::Button::autoRepeat + + This property holds whether the button repeats pressed(), released() + and clicked() signals while the button is pressed and held down. + + The default value is \c false. +*/ + +void QQuickButton::autoRepeatChange() +{ + emit autoRepeatChanged(); +} + QFont QQuickButton::defaultFont() const { return QQuickControlPrivate::themeFont(QPlatformTheme::PushButtonFont); diff --git a/src/quicktemplates2/qquickbutton_p.h b/src/quicktemplates2/qquickbutton_p.h index cdc97321..90aa5176 100644 --- a/src/quicktemplates2/qquickbutton_p.h +++ b/src/quicktemplates2/qquickbutton_p.h @@ -56,15 +56,18 @@ class Q_QUICKTEMPLATES2_EXPORT QQuickButton : public QQuickAbstractButton { Q_OBJECT Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY checkableChanged FINAL) + Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat NOTIFY autoRepeatChanged FINAL) public: explicit QQuickButton(QQuickItem *parent = nullptr); Q_SIGNALS: void checkableChanged(); + void autoRepeatChanged(); protected: void checkableChange() override; + void autoRepeatChange() override; QFont defaultFont() const override; }; diff --git a/src/quicktemplates2/qquickswipedelegate.cpp b/src/quicktemplates2/qquickswipedelegate.cpp index 111448c9..9156d7a3 100644 --- a/src/quicktemplates2/qquickswipedelegate.cpp +++ b/src/quicktemplates2/qquickswipedelegate.cpp @@ -562,9 +562,7 @@ bool QQuickSwipeDelegatePrivate::handleMouseMoveEvent(QQuickItem *item, QMouseEv { Q_Q(QQuickSwipeDelegate); - if (autoRepeat) { - stopPressRepeat(); - } else if (holdTimer > 0) { + if (holdTimer > 0) { if (QLineF(pressPoint, event->localPos()).length() > QGuiApplication::styleHints()->startDragDistance()) stopPressAndHold(); } |