aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickspinbox.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-09-27 14:47:06 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-09-28 10:00:39 +0000
commit25a3f25ce98c0a88582e97cfcdede970e7cc4a6d (patch)
treeca1d10cc8202c58f448a0e0efbed627be6d9dc9d /src/quicktemplates2/qquickspinbox.cpp
parent1ba9feea60bae12febdb6d640eb5f2617c8d4b79 (diff)
SpinBox: don't call valueFromText when non-editable
If there are custom values like 00:00:00 for time and valueFromText is not implemented, tab navigation sets the value to 0, because the default implementation cannot evaluate it. Change-Id: I0384a2015b2c2a4dc2ee0e57f1ece410c339838e Task-number: QTBUG-56215 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickspinbox.cpp')
-rw-r--r--src/quicktemplates2/qquickspinbox.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/quicktemplates2/qquickspinbox.cpp b/src/quicktemplates2/qquickspinbox.cpp
index b7595b71..116d1e12 100644
--- a/src/quicktemplates2/qquickspinbox.cpp
+++ b/src/quicktemplates2/qquickspinbox.cpp
@@ -612,7 +612,7 @@ void QQuickSpinBox::keyReleaseEvent(QKeyEvent *event)
Q_D(QQuickSpinBox);
QQuickControl::keyReleaseEvent(event);
- if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
+ if (d->editable && (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return))
d->updateValue();
d->up->setPressed(false);
@@ -704,7 +704,7 @@ void QQuickSpinBox::itemChange(ItemChange change, const ItemChangeData &value)
{
Q_D(QQuickSpinBox);
QQuickControl::itemChange(change, value);
- if (change == ItemActiveFocusHasChanged && !value.boolValue)
+ if (d->editable && change == ItemActiveFocusHasChanged && !value.boolValue)
d->updateValue();
}