aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-11-17 20:27:10 +0100
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-11-17 20:27:10 +0100
commitbcf7f7e6408872d8315e5c69829d7ce790e4820a (patch)
tree7aab214c796779dd92ae050e13824c1ec850a85b
parentd97195d3c67dcf08d727a2a65863b99982c6b24e (diff)
downloadlibquotient-bcf7f7e6408872d8315e5c69829d7ce790e4820a.tar.gz
libquotient-bcf7f7e6408872d8315e5c69829d7ce790e4820a.zip
Fix QDateTime(QDate) deprecation warnings
-rw-r--r--lib/converters.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/converters.h b/lib/converters.h
index d9a68bfb..8ec0fa81 100644
--- a/lib/converters.h
+++ b/lib/converters.h
@@ -146,7 +146,15 @@ struct JsonConverter<QDateTime> {
template <>
struct JsonConverter<QDate> {
- static auto dump(const QDate& val) { return toJson(QDateTime(val)); }
+ static auto dump(const QDate& val) {
+ return toJson(
+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
+ QDateTime(val)
+#else
+ val.startOfDay()
+#endif
+ );
+ }
static auto load(const QJsonValue& jv)
{
return fromJson<QDateTime>(jv).date();