1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 11:45:53 +01:00

Fixed TimeZoneInfo QVariant loading/saving in QT6

This commit is contained in:
Martin Tůma 2020-12-28 16:08:36 +01:00
parent 60bb42d708
commit bafbb825fc
2 changed files with 16 additions and 0 deletions

View File

@ -3,6 +3,7 @@
#include <QTimeZone>
#include <QDataStream>
#include <QDebug>
class TimeZoneInfo
{
@ -42,6 +43,7 @@ public:
private:
friend QDataStream& operator<<(QDataStream &out, const TimeZoneInfo &info);
friend QDataStream& operator>>(QDataStream &in, TimeZoneInfo &info);
friend QDebug operator<<(QDebug dbg, const TimeZoneInfo &info);
Type _type;
QTimeZone _customZone;
@ -66,4 +68,13 @@ inline QDataStream &operator>>(QDataStream &in, TimeZoneInfo &info)
return in;
}
#ifndef QT_NO_DEBUG
inline QDebug operator<<(QDebug dbg, const TimeZoneInfo &info)
{
dbg.nospace() << "TimeZoneInfo(" << static_cast<int>(info._type)
<< ", " << info._customZone << ")";
return dbg.space();
}
#endif // QT_NO_DEBUG
#endif // TIMEZONEINFO_H

View File

@ -1,10 +1,15 @@
#include "GUI/app.h"
#include "GUI/timezoneinfo.h"
int main(int argc, char *argv[])
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
qRegisterMetaTypeStreamOperators<TimeZoneInfo>("TimeZoneInfo");
#else // QT6
qRegisterMetaType<TimeZoneInfo>("TimeZoneInfo");
#endif // QT6
App app(argc, argv);