From cd0813f04304a7bb7664975704edf644a541ed58 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 5 Aug 2023 18:58:29 +0300 Subject: [PATCH] Fix compatibility with < Qt 6. --- src/app/tape/mapplication.cpp | 13 +++++-------- src/app/tape/tmainwindow.cpp | 1 - src/libs/vmisc/theme/themeDef.h | 14 ++++++++++++++ src/libs/vmisc/theme/vstylesheetstyle.h | 4 ++++ src/libs/vtools/visualization/visualization.h | 12 ------------ src/libs/vwidgets/vgraphicssimpletextitem.h | 3 +-- 6 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/app/tape/mapplication.cpp b/src/app/tape/mapplication.cpp index a5b717077..4ae2ea4d0 100644 --- a/src/app/tape/mapplication.cpp +++ b/src/app/tape/mapplication.cpp @@ -27,18 +27,20 @@ *************************************************************************/ #include "mapplication.h" +#include "../fervor/fvupdater.h" #include "../ifc/exception/vexceptionbadid.h" #include "../ifc/exception/vexceptionconversionerror.h" #include "../ifc/exception/vexceptionemptyparameter.h" #include "../ifc/exception/vexceptionobjecterror.h" #include "../ifc/exception/vexceptionwrongid.h" +#include "../qmuparser/qmuparsererror.h" #include "../vganalytics/def.h" #include "../vganalytics/vganalytics.h" #include "../vmisc/projectversion.h" +#include "../vmisc/qt_dispatch/qt_dispatch.h" #include "../vmisc/theme/vapplicationstyle.h" #include "../vmisc/theme/vtheme.h" #include "../vmisc/vsysexits.h" -#include "qtpreprocessorsupport.h" #include "tmainwindow.h" #include "version.h" @@ -46,10 +48,7 @@ #include "../vmisc/diagnostic.h" #endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0) -#include "../fervor/fvupdater.h" -#include "../qmuparser/qmuparsererror.h" -#include "../vmisc/qt_dispatch/qt_dispatch.h" - +#include #include #include #include @@ -63,6 +62,7 @@ #include #include #include +#include #include #if !defined(BUILD_REVISION) && defined(QBS_BUILD) @@ -82,9 +82,6 @@ Q_LOGGING_CATEGORY(mApp, "m.application") // NOLINT QT_WARNING_POP -#include -#include - namespace { QT_WARNING_PUSH diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index b9158dff2..1fdcb2443 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -57,7 +57,6 @@ #include "dialogs/dialogsetupmultisize.h" #include "dialogs/dialogtapepreferences.h" #include "mapplication.h" // Should be last because of definning qApp -#include "qtpreprocessorsupport.h" #include "ui_tmainwindow.h" #include "vlitepattern.h" #include "vtapesettings.h" diff --git a/src/libs/vmisc/theme/themeDef.h b/src/libs/vmisc/theme/themeDef.h index 704dd1667..78ef3a4a9 100644 --- a/src/libs/vmisc/theme/themeDef.h +++ b/src/libs/vmisc/theme/themeDef.h @@ -28,6 +28,12 @@ #ifndef THEMEDEF_H #define THEMEDEF_H +#include + +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#include +#endif + enum class VColorRole { DefaultColor, @@ -53,4 +59,12 @@ enum class VColorRole PieceNodeLabelLineColor }; +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +Q_DECL_CONST_FUNCTION inline auto qHash(VColorRole key, uint seed = 0) noexcept -> uint +{ + auto underlyingValue = static_cast::type>(key); + return ::qHash(underlyingValue, seed); +} +#endif + #endif // THEMEDEF_H diff --git a/src/libs/vmisc/theme/vstylesheetstyle.h b/src/libs/vmisc/theme/vstylesheetstyle.h index f2821da65..21d0bfd39 100644 --- a/src/libs/vmisc/theme/vstylesheetstyle.h +++ b/src/libs/vmisc/theme/vstylesheetstyle.h @@ -28,7 +28,11 @@ #ifndef VSTYLESHEETSTYLE_H #define VSTYLESHEETSTYLE_H +#include + +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #include +#endif class QJsonObject; class QJsonValue; diff --git a/src/libs/vtools/visualization/visualization.h b/src/libs/vtools/visualization/visualization.h index b6a41e39d..147287e1e 100644 --- a/src/libs/vtools/visualization/visualization.h +++ b/src/libs/vtools/visualization/visualization.h @@ -34,10 +34,6 @@ #include #include -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) -#include -#endif - #include "../vgeometry/vabstractcurve.h" #include "../vmisc/def.h" #include "../vmisc/vabstractvalapplication.h" @@ -57,14 +53,6 @@ enum class Mode : qint8 Show }; -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) -Q_DECL_CONST_FUNCTION inline auto qHash(VColor key, uint seed = 0) noexcept -> uint -{ - auto underlyingValue = static_cast::type>(key); - return ::qHash(underlyingValue, seed); -} -#endif - QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wsuggest-final-types") QT_WARNING_DISABLE_GCC("-Wsuggest-final-methods") diff --git a/src/libs/vwidgets/vgraphicssimpletextitem.h b/src/libs/vwidgets/vgraphicssimpletextitem.h index b9de441cc..b0633fd22 100644 --- a/src/libs/vwidgets/vgraphicssimpletextitem.h +++ b/src/libs/vwidgets/vgraphicssimpletextitem.h @@ -39,8 +39,7 @@ #include #include "../vmisc/def.h" -#include "qtclasshelpermacros.h" -#include "theme/themeDef.h" +#include "../vmisc/theme/themeDef.h" #if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) #include "../vmisc/defglobal.h"