Fix compatibility with < Qt 6.

This commit is contained in:
Roman Telezhynskyi 2023-08-05 18:58:29 +03:00
parent 5e6e1e2844
commit cd0813f043
6 changed files with 24 additions and 23 deletions

View File

@ -27,18 +27,20 @@
*************************************************************************/ *************************************************************************/
#include "mapplication.h" #include "mapplication.h"
#include "../fervor/fvupdater.h"
#include "../ifc/exception/vexceptionbadid.h" #include "../ifc/exception/vexceptionbadid.h"
#include "../ifc/exception/vexceptionconversionerror.h" #include "../ifc/exception/vexceptionconversionerror.h"
#include "../ifc/exception/vexceptionemptyparameter.h" #include "../ifc/exception/vexceptionemptyparameter.h"
#include "../ifc/exception/vexceptionobjecterror.h" #include "../ifc/exception/vexceptionobjecterror.h"
#include "../ifc/exception/vexceptionwrongid.h" #include "../ifc/exception/vexceptionwrongid.h"
#include "../qmuparser/qmuparsererror.h"
#include "../vganalytics/def.h" #include "../vganalytics/def.h"
#include "../vganalytics/vganalytics.h" #include "../vganalytics/vganalytics.h"
#include "../vmisc/projectversion.h" #include "../vmisc/projectversion.h"
#include "../vmisc/qt_dispatch/qt_dispatch.h"
#include "../vmisc/theme/vapplicationstyle.h" #include "../vmisc/theme/vapplicationstyle.h"
#include "../vmisc/theme/vtheme.h" #include "../vmisc/theme/vtheme.h"
#include "../vmisc/vsysexits.h" #include "../vmisc/vsysexits.h"
#include "qtpreprocessorsupport.h"
#include "tmainwindow.h" #include "tmainwindow.h"
#include "version.h" #include "version.h"
@ -46,10 +48,7 @@
#include "../vmisc/diagnostic.h" #include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../fervor/fvupdater.h" #include <QCommandLineParser>
#include "../qmuparser/qmuparsererror.h"
#include "../vmisc/qt_dispatch/qt_dispatch.h"
#include <QDir> #include <QDir>
#include <QFileOpenEvent> #include <QFileOpenEvent>
#include <QGlobalStatic> #include <QGlobalStatic>
@ -63,6 +62,7 @@
#include <QStyleFactory> #include <QStyleFactory>
#include <QThread> #include <QThread>
#include <QTranslator> #include <QTranslator>
#include <QUuid>
#include <iostream> #include <iostream>
#if !defined(BUILD_REVISION) && defined(QBS_BUILD) #if !defined(BUILD_REVISION) && defined(QBS_BUILD)
@ -82,9 +82,6 @@ Q_LOGGING_CATEGORY(mApp, "m.application") // NOLINT
QT_WARNING_POP QT_WARNING_POP
#include <QCommandLineParser>
#include <QUuid>
namespace namespace
{ {
QT_WARNING_PUSH QT_WARNING_PUSH

View File

@ -57,7 +57,6 @@
#include "dialogs/dialogsetupmultisize.h" #include "dialogs/dialogsetupmultisize.h"
#include "dialogs/dialogtapepreferences.h" #include "dialogs/dialogtapepreferences.h"
#include "mapplication.h" // Should be last because of definning qApp #include "mapplication.h" // Should be last because of definning qApp
#include "qtpreprocessorsupport.h"
#include "ui_tmainwindow.h" #include "ui_tmainwindow.h"
#include "vlitepattern.h" #include "vlitepattern.h"
#include "vtapesettings.h" #include "vtapesettings.h"

View File

@ -28,6 +28,12 @@
#ifndef THEMEDEF_H #ifndef THEMEDEF_H
#define THEMEDEF_H #define THEMEDEF_H
#include <QtGlobal>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QtCore/QHashFunctions>
#endif
enum class VColorRole enum class VColorRole
{ {
DefaultColor, DefaultColor,
@ -53,4 +59,12 @@ enum class VColorRole
PieceNodeLabelLineColor 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<typename std::underlying_type<VColorRole>::type>(key);
return ::qHash(underlyingValue, seed);
}
#endif
#endif // THEMEDEF_H #endif // THEMEDEF_H

View File

@ -28,7 +28,11 @@
#ifndef VSTYLESHEETSTYLE_H #ifndef VSTYLESHEETSTYLE_H
#define VSTYLESHEETSTYLE_H #define VSTYLESHEETSTYLE_H
#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <QtCore/QtCompilerDetection> #include <QtCore/QtCompilerDetection>
#endif
class QJsonObject; class QJsonObject;
class QJsonValue; class QJsonValue;

View File

@ -34,10 +34,6 @@
#include <QObject> #include <QObject>
#include <QtGlobal> #include <QtGlobal>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QtCore/QHashFunctions>
#endif
#include "../vgeometry/vabstractcurve.h" #include "../vgeometry/vabstractcurve.h"
#include "../vmisc/def.h" #include "../vmisc/def.h"
#include "../vmisc/vabstractvalapplication.h" #include "../vmisc/vabstractvalapplication.h"
@ -57,14 +53,6 @@ enum class Mode : qint8
Show 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<typename std::underlying_type<VColor>::type>(key);
return ::qHash(underlyingValue, seed);
}
#endif
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wsuggest-final-types") QT_WARNING_DISABLE_GCC("-Wsuggest-final-types")
QT_WARNING_DISABLE_GCC("-Wsuggest-final-methods") QT_WARNING_DISABLE_GCC("-Wsuggest-final-methods")

View File

@ -39,8 +39,7 @@
#include <QtGlobal> #include <QtGlobal>
#include "../vmisc/def.h" #include "../vmisc/def.h"
#include "qtclasshelpermacros.h" #include "../vmisc/theme/themeDef.h"
#include "theme/themeDef.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h" #include "../vmisc/defglobal.h"