summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qdatetime.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2015-01-14 15:34:45 -0800
committerThiago Macieira <thiago.macieira@intel.com>2015-01-15 08:37:10 +0100
commitc3590c76775c889fde13dc155c2a31508db612e9 (patch)
treef625178ceadd6d650b4ec7e2f52a6adaa8c44a97 /src/corelib/tools/qdatetime.cpp
parent13ecde3b7af364be2db466029f796f3cb6310685 (diff)
Update doc saying QDateTime::setTime with invalid time sets to midnight
QDateTimePrivate::setDateTime has a comment saying this is intentional, so document it. Task-number: QTBUG-43704 Change-Id: Ic5d393bfd36e48a193fcffff13b965409eaf7be9 Reviewed-by: Martin Smith <martin.smith@digia.com>
Diffstat (limited to 'src/corelib/tools/qdatetime.cpp')
-rw-r--r--src/corelib/tools/qdatetime.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index d52dea8d4f..082b721e82 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -3296,8 +3296,8 @@ bool QDateTime::isDaylightTime() const
}
/*!
- Sets the date part of this datetime to \a date.
- If no time is set, it is set to midnight.
+ Sets the date part of this datetime to \a date. If no time is set yet, it
+ is set to midnight. If \a date is invalid, this QDateTime becomes invalid.
\sa date(), setTime(), setTimeSpec()
*/
@@ -3309,7 +3309,14 @@ void QDateTime::setDate(const QDate &date)
}
/*!
- Sets the time part of this datetime to \a time.
+ Sets the time part of this datetime to \a time. If \a time is not valid,
+ this function sets it to midnight. Therefore, it's possible to clear any
+ set time in a QDateTime by setting it to a default QTime:
+
+ \code
+ QDateTime dt = QDateTime::currentDateTime();
+ dt.setTime(QTime());
+ \endcode
\sa time(), setDate(), setTimeSpec()
*/