summaryrefslogtreecommitdiff
path: root/src/controls/SpinBox.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2014-07-18 07:51:14 +0200
committerJ-P Nurmi <jpnurmi@digia.com>2014-07-18 17:37:49 +0200
commit15d7ab65d1b8772a68258573141874d7f5cd2be5 (patch)
treed10ac54bc5373e7e312b773f2c2b8e0503e783da /src/controls/SpinBox.qml
parent85452fe6f4d30e09107533a488c39f895605aed7 (diff)
downloadqtquickcontrols-15d7ab65d1b8772a68258573141874d7f5cd2be5.tar.gz
SpinBox: add support for selection handles
Task-number: QTBUG-38934 Change-Id: I8f23d20a24977f1787dcd451b48b22326959e3bc Reviewed-by: Liang Qi <liang.qi@digia.com>
Diffstat (limited to 'src/controls/SpinBox.qml')
-rw-r--r--src/controls/SpinBox.qml28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/controls/SpinBox.qml b/src/controls/SpinBox.qml
index d1161784..758be809 100644
--- a/src/controls/SpinBox.qml
+++ b/src/controls/SpinBox.qml
@@ -164,7 +164,7 @@ Control {
This property indicates whether the control is being hovered.
*/
- readonly property bool hovered: mouseArea.containsMouse || cursorArea.containsMouse
+ readonly property bool hovered: mouseArea.containsMouse || input.containsMouse
|| mouseUp.containsMouse || mouseDown.containsMouse
/*!
@@ -181,6 +181,17 @@ Control {
signal editingFinished()
/*!
+ \qmlproperty bool SpinBox::selectByMouse
+ \since QtQuick.Controls 1.3
+
+ This property determines if the user can select the text with the
+ mouse.
+
+ The default value is \c true.
+ */
+ property bool selectByMouse: true
+
+ /*!
\qmlproperty bool SpinBox::inputMethodComposing
\since QtQuick.Controls 1.3
@@ -261,7 +272,7 @@ Control {
}
}
- TextInput {
+ TextInputWithHandles {
id: input
clip: contentWidth > width
anchors.fill: parent
@@ -270,12 +281,15 @@ Control {
anchors.rightMargin: __style ? __style.padding.right: 0
anchors.bottomMargin: __style ? __style.padding.bottom: 0
+ control: spinbox
+ cursorHandle: __style ? __style.cursorHandle : undefined
+ selectionHandle: __style ? __style.selectionHandle : undefined
+
focus: true
activeFocusOnPress: spinbox.activeFocusOnPress
horizontalAlignment: spinbox.horizontalAlignment
verticalAlignment: __panel ? __panel.verticalAlignment : Qt.AlignVCenter
- selectByMouse: activeFocus || activeFocusOnPress
inputMethodHints: Qt.ImhFormattedNumbersOnly
validator: SpinBoxValidator {
@@ -304,14 +318,6 @@ Control {
function selectValue() {
select(prefix.length, text.length - suffix.length)
}
-
- MouseArea {
- id: cursorArea
- anchors.fill: parent
- hoverEnabled: true
- cursorShape: Qt.IBeamCursor
- acceptedButtons: Qt.NoButton
- }
}
// Spinbox increment button