Skip to content

Commit

Permalink
Fix a date-time with invalid QTime to use a valid one
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
ediosyncratic committed Aug 4, 2022
1 parent 607c5a9 commit dcaa05f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/widgets/widgets/qdatetimeedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit dcaa05f

Please sign in to comment.