summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qabstractspinbox.cpp
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-12-10 10:27:51 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-12-10 10:29:28 (GMT)
commitbb0ab1d8cf57dd4a7b69c8478c2a40c1cd1782e9 (patch)
tree6791642658e71828ce796dc4fc11c06a83e5462b /src/gui/widgets/qabstractspinbox.cpp
parentba9ea2b97bdd2329cb479bb7a6aef1bc7cee82d1 (diff)
downloadQt-bb0ab1d8cf57dd4a7b69c8478c2a40c1cd1782e9.zip
Qt-bb0ab1d8cf57dd4a7b69c8478c2a40c1cd1782e9.tar.gz
Qt-bb0ab1d8cf57dd4a7b69c8478c2a40c1cd1782e9.tar.bz2
Fix spinbox input when seecting the prefix
If you were selcting the prefix and entering a digit the cursor position would not be updated correctly Task-number: QTBUG-6670 Reviewed-by: ogoffart
Diffstat (limited to 'src/gui/widgets/qabstractspinbox.cpp')
-rw-r--r--src/gui/widgets/qabstractspinbox.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/gui/widgets/qabstractspinbox.cpp
index a18af4f..c015589 100644
--- a/src/gui/widgets/qabstractspinbox.cpp
+++ b/src/gui/widgets/qabstractspinbox.cpp
@@ -1856,8 +1856,10 @@ QValidator::State QSpinBoxValidator::validate(QString &input, int &pos) const
if (dptr->specialValueText.size() > 0 && input == dptr->specialValueText)
return QValidator::Acceptable;
- if (!dptr->prefix.isEmpty() && !input.startsWith(dptr->prefix))
+ if (!dptr->prefix.isEmpty() && !input.startsWith(dptr->prefix)) {
input.prepend(dptr->prefix);
+ pos += dptr->prefix.length();
+ }
if (!dptr->suffix.isEmpty() && !input.endsWith(dptr->suffix))
input.append(dptr->suffix);