QDateTime: Remove the distinction between null and invalid date and time
Change-Id: Id5480807d25e49e78b79ffff144a523e6851c03f Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>bb10
parent
f402b4886d
commit
b491fab02a
|
|
@ -2546,15 +2546,13 @@ void QDateTimePrivate::setDateTime(const QDate &date, const QTime &time)
|
|||
if (!useTime.isValid() && date.isValid())
|
||||
useTime = QTime::fromMSecsSinceStartOfDay(0);
|
||||
|
||||
StatusFlags newStatus;
|
||||
StatusFlags newStatus = 0;
|
||||
|
||||
// Set date value and status
|
||||
qint64 days = 0;
|
||||
if (date.isValid()) {
|
||||
days = date.toJulianDay() - JULIAN_DAY_FOR_EPOCH;
|
||||
newStatus = ValidDate;
|
||||
} else if (date.isNull()) {
|
||||
newStatus = NullDate;
|
||||
}
|
||||
|
||||
// Set time value and status
|
||||
|
|
@ -2562,8 +2560,6 @@ void QDateTimePrivate::setDateTime(const QDate &date, const QTime &time)
|
|||
if (useTime.isValid()) {
|
||||
ds = useTime.msecsSinceStartOfDay();
|
||||
newStatus |= ValidTime;
|
||||
} else if (time.isNull()) {
|
||||
newStatus |= NullTime;
|
||||
}
|
||||
|
||||
// Set msecs serial value
|
||||
|
|
|
|||
|
|
@ -131,8 +131,8 @@ public:
|
|||
void refreshDateTime();
|
||||
|
||||
// Get/set date and time status
|
||||
inline bool isNullDate() const { return m_status & NullDate; }
|
||||
inline bool isNullTime() const { return m_status & NullTime; }
|
||||
inline bool isNullDate() const { return !(m_status & ValidDate); }
|
||||
inline bool isNullTime() const { return !(m_status & ValidTime); }
|
||||
inline bool isValidDate() const { return m_status & ValidDate; }
|
||||
inline bool isValidTime() const { return m_status & ValidTime; }
|
||||
inline bool isValidDateTime() const { return m_status & ValidDateTime; }
|
||||
|
|
|
|||
Loading…
Reference in New Issue