If you look at the code QDateTime is a little bit more complex:
qint64 m_msecs;
StatusFlags m_status;
int m_offsetFromUtc;
mutable QAtomicInt ref;
#if QT_CONFIG(timezone)
QTimeZone m_timeZone;
#endif // timezone
qint64 m_msecs;
StatusFlags m_status;
int m_offsetFromUtc;
mutable QAtomicInt ref;
#if QT_CONFIG(timezone)
QTimeZone m_timeZone;
#endif // timezone
To copy to clipboard, switch view to plain text mode
The QDateTime class with all its additional features like status and time zone information seems to be complex enough for Qt developers to assume that future changes might require modifying member variables. Hence they chose the D-Pointer pattern to allow those changes without breaking ABI. Preserving the ABI is important for all parts of the Qt libs (except some 'private' parts, eg. the API for writing QPA-plugins).
However, I also find that QDateTime class is a bit of an overkill. Additionally, it lacks a 'TimeSpan' class. So I usually use my own classes which I actually wrote to learn C++.
Bookmarks