diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2013-12-11 13:44:52 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-12 11:12:48 +0100 |
commit | 29a362c1915f82e8eb89cf9788d2379acb67d24d (patch) | |
tree | 18a4891529b5297c6e85b183c1188b9337ed314c | |
parent | 25a8c637ec923b81dada1bb7e109ccffd1730f14 (diff) |
SpinBox: fix selection behavior
Automatic value selection and focus must go hand in hand. A selection
without focus is pointless, because one can't then type or even copy
the value.
This patch ensures that the automatic selection is only done when the
control has active focus. Furthermore, manual selection is only enabled
when either activeFocusOnPress is true or when the control has gained
active focus by other means (activeFocusOnTab or programmatically).
Change-Id: Id0c6a55a6f4a55eb419d06d5dcb3f25a36fe2ec5
Reviewed-by: Martin Klapetek <mklapetek@kde.org>
Reviewed-by: Liang Qi <liang.qi@digia.com>
-rw-r--r-- | src/controls/SpinBox.qml | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/controls/SpinBox.qml b/src/controls/SpinBox.qml index c756566de..4dc03d977 100644 --- a/src/controls/SpinBox.qml +++ b/src/controls/SpinBox.qml @@ -180,13 +180,15 @@ Control { /*! \internal */ function __increment() { validator.increment() - input.selectValue() + if (activeFocus) + input.selectValue() } /*! \internal */ function __decrement() { validator.decrement() - input.selectValue() + if (activeFocus) + input.selectValue() } /*! \internal */ @@ -253,7 +255,7 @@ Control { horizontalAlignment: spinbox.horizontalAlignment verticalAlignment: __panel ? __panel.verticalAlignment : Qt.AlignVCenter - selectByMouse: true + selectByMouse: activeFocus || activeFocusOnPress validator: SpinBoxValidator { id: validator |