Fix a date-time with invalid QTime to use a valid one

Using QTime(), which is null and invalid, as the time field of a
QDateTime is supported, but is ill-advised. Use the start of the day
instead.

Change-Id: If30db046218926f7634bbcfcf35cd000d7f6535f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Edward Welbourne 2022-08-03 17:24:51 +02:00
parent 607c5a90c5
commit dcaa05f697
1 changed files with 1 additions and 1 deletions

View File

@ -957,7 +957,7 @@ void QDateTimeEdit::setDisplayFormat(const QString &format)
}
} else if (dateShown && !timeShown) {
setTimeRange(QDATETIMEEDIT_TIME_MIN, QDATETIMEEDIT_TIME_MAX);
d->value = QDateTime(d->value.toDate(), QTime(), d->spec);
d->value = d->value.toDate().startOfDay(d->spec);
}
d->updateEdit();
d->_q_editorCursorPositionChanged(-1, 0);