summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qdatetimeedit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/widgets/qdatetimeedit.cpp')
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index f1db87f414..aa19270af5 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -2000,7 +2000,14 @@ QDateTime QDateTimeEditPrivate::validateAndInterpret(QString &input, int &positi
return minimum.toDateTime();
}
}
+
StateNode tmp = parse(input, position, value.toDateTime(), fixup);
+ // Impose this widget's spec:
+ tmp.value = tmp.value.toTimeSpec(spec);
+ // ... but that might turn a valid datetime into an invalid one:
+ if (!tmp.value.isValid() && tmp.state == Acceptable)
+ tmp.state = Intermediate;
+
input = tmp.input;
position += tmp.padded;
state = QValidator::State(int(tmp.state));