aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickabstractbutton.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-11-17 18:35:24 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2016-11-17 18:35:24 +0100
commit4f2bb3e5a1ecbb1728209c7b2525c2c645ef49a2 (patch)
treef3be806d0301078e69d3043c2ac1d370aca14825 /src/quicktemplates2/qquickabstractbutton.cpp
parent170869fe1457fc68e96d46c9ff804071f86bd029 (diff)
parent4ef7af98e69bf676dd39e6aad5e6a5f980648e75 (diff)
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts: src/quickcontrols2/qquickstyle.cpp src/quicktemplates2/qquickslider.cpp Change-Id: Ie12132690680706def6f516334a6ef0ba27336b3
Diffstat (limited to 'src/quicktemplates2/qquickabstractbutton.cpp')
-rw-r--r--src/quicktemplates2/qquickabstractbutton.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/quicktemplates2/qquickabstractbutton.cpp b/src/quicktemplates2/qquickabstractbutton.cpp
index 85f58fd5..350af84a 100644
--- a/src/quicktemplates2/qquickabstractbutton.cpp
+++ b/src/quicktemplates2/qquickabstractbutton.cpp
@@ -332,6 +332,8 @@ void QQuickAbstractButton::setPressed(bool isPressed)
\qmlproperty bool QtQuick.Controls::AbstractButton::checked
This property holds whether the button is checked.
+
+ \sa checkable
*/
bool QQuickAbstractButton::isChecked() const
{
@@ -354,11 +356,21 @@ void QQuickAbstractButton::setChecked(bool checked)
emit checkedChanged();
}
-// We define these in QQuickAbstractButton without exposing checkable as a
-// property, and instead expose it as a property in QQuickButton.
-// QQuickRadioButton, QQuickSwitch and QQuickCheckBox are checkable by default,
-// but if we removed the checkable code from here, they'd each have to
-// duplicate it.
+/*!
+ \qmlproperty bool QtQuick.Controls::AbstractButton::checkable
+
+ This property holds whether the button is checkable.
+
+ A checkable button toggles between checked (on) and unchecked (off) when
+ the user clicks on it or presses the space bar while the button has active
+ focus.
+
+ Setting \l checked to \c true forces this property to \c true.
+
+ The default value is \c false.
+
+ \sa checked
+*/
bool QQuickAbstractButton::isCheckable() const
{
Q_D(const QQuickAbstractButton);
@@ -374,6 +386,7 @@ void QQuickAbstractButton::setCheckable(bool checkable)
d->checkable = checkable;
setAccessibleProperty("checkable", checkable);
checkableChange();
+ emit checkableChanged();
}
/*!
@@ -529,7 +542,7 @@ void QQuickAbstractButton::mouseMoveEvent(QMouseEvent *event)
QQuickControl::mouseMoveEvent(event);
setPressed(d->keepPressed || contains(event->pos()));
- if (d->autoRepeat)
+ if (!d->pressed && d->autoRepeat)
d->stopPressRepeat();
else if (d->holdTimer > 0 && (!d->pressed || QLineF(d->pressPoint, event->localPos()).length() > QGuiApplication::styleHints()->startDragDistance()))
d->stopPressAndHold();