diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2016-07-08 14:41:49 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2016-10-10 16:19:53 +0000 |
commit | bff683416c73329eb91bdb0bc282f4022c9fec7e (patch) | |
tree | b98f605794261e3ac8c03aeccd25e97bb3b5e463 /src/widgets/widgets/qdatetimeedit.cpp | |
parent | ebd1046323615f22192055a94438bf85fc360ca3 (diff) |
QDateTimeEditPrivate:: only ask for fieldInfo() if section index is real
On construction, currentSectionIndex has the fake value
FirstSectionIndex, which upsets fieldInfo(), leading to a qWarning().
Make interpret(), when deciding whether to delegate to base or handle
the value itself, treat fake index value as an invalid state.
Task-number: QTBUG-54654
Change-Id: I6d0f71874839abfafcbfaaa0018362288f32a3cd
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'src/widgets/widgets/qdatetimeedit.cpp')
-rw-r--r-- | src/widgets/widgets/qdatetimeedit.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index 96a37197e9..98b0489dfc 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -2344,7 +2344,9 @@ void QDateTimeEditPrivate::interpret(EmitPolicy ep) const QValidator::State state = q->validate(tmp, pos); if (state != QValidator::Acceptable && correctionMode == QAbstractSpinBox::CorrectToPreviousValue - && (state == QValidator::Invalid || !(fieldInfo(currentSectionIndex) & AllowPartial))) { + && (state == QValidator::Invalid + || currentSectionIndex < 0 + || !(fieldInfo(currentSectionIndex) & AllowPartial))) { setValue(value, ep); updateTimeSpec(); } else { |