diff options
-rw-r--r-- | src/widgets/widgets/qdatetimeedit.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index df3b7c3876..5697c96791 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -2107,18 +2107,10 @@ QDateTime QDateTimeEditPrivate::stepBy(int sectionIndex, int steps, bool test) c int pos = edit->cursorPosition(); const SectionNode sn = sectionNode(sectionIndex); - int val; // to make sure it behaves reasonably when typing something and then stepping in non-tracking mode - if (!test && pendingEmit) { - if (q->validate(str, pos) != QValidator::Acceptable) { - v = value.toDateTime(); - } else { - v = q->dateTimeFromText(str); - } - val = getDigit(v, sectionIndex); - } else { - val = getDigit(v, sectionIndex); - } + if (!test && pendingEmit && q->validate(str, pos) == QValidator::Acceptable) + v = q->dateTimeFromText(str); + int val = getDigit(v, sectionIndex); val += steps; |