diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2021-11-30 12:46:50 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-02-16 16:07:12 +0200 |
commit | 0905bf78e2584bbdff05a15826bdaba4170579d6 (patch) | |
tree | eab51ff64a5e87e50763ec510b4b440145adf72e /odb/qt/date-time/sqlite/qdate-time-traits.hxx | |
parent | ecaafacbe574069d749f3a006259d179028f2399 (diff) |
Avoid using deprecated APIs in Qt5 and Qt6
Note that support for QLinkedList can be enabled with the
ODB_QT_FORCE_QLINKEDLIST macro.
Diffstat (limited to 'odb/qt/date-time/sqlite/qdate-time-traits.hxx')
-rw-r--r-- | odb/qt/date-time/sqlite/qdate-time-traits.hxx | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/odb/qt/date-time/sqlite/qdate-time-traits.hxx b/odb/qt/date-time/sqlite/qdate-time-traits.hxx index 143b0f4..db561fc 100644 --- a/odb/qt/date-time/sqlite/qdate-time-traits.hxx +++ b/odb/qt/date-time/sqlite/qdate-time-traits.hxx @@ -10,6 +10,8 @@ #include <cstddef> // std::size_t #include <cstring> // std::memcpy +#include <QtCore/QtGlobal> // QT_VERSION + #include <QtCore/QDateTime> #include <odb/details/buffer.hxx> @@ -90,7 +92,14 @@ namespace odb else { v.setTimeSpec (Qt::UTC); - v.setTime_t (static_cast <uint> (i)); + + // *Time_t() functions are deprecated in favor of *SecsSinceEpoch(). + // +#if QT_VERSION < 0x060000 + v.setTime_t (static_cast<uint> (i)); +#else + v.setSecsSinceEpoch (static_cast<qint64> (i)); +#endif } } @@ -106,7 +115,12 @@ namespace odb else { is_null = false; + +#if QT_VERSION < 0x060000 i = static_cast<long long> (v.toTime_t ()); +#else + i = static_cast<long long> (v.toSecsSinceEpoch ()); +#endif } } }; |