From a616f13913c746a71fff7e8b411cc0add41b7902 Mon Sep 17 00:00:00 2001 From: Andreas Bacher Date: Wed, 3 Apr 2024 13:08:03 +0200 Subject: [PATCH] Compatibility with Qt5.x --- ChangeLog.md | 2 ++ src/log4qt/CMakeLists.txt | 1 + src/log4qt/appender.h | 1 + src/log4qt/basicconfigurator.h | 1 + src/log4qt/helpers/configuratorhelper.h | 1 + src/log4qt/helpers/factory.h | 1 + src/log4qt/helpers/initialisationhelper.h | 1 + src/log4qt/helpers/optionconverter.h | 1 + src/log4qt/helpers/patternformatter.h | 1 + src/log4qt/layout.h | 1 + src/log4qt/log4qt.h | 6 ------ src/log4qt/log4qtdefs.h | 16 ++++++++++++++++ src/log4qt/mdc.h | 1 + src/log4qt/ndc.h | 3 ++- 14 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 src/log4qt/log4qtdefs.h diff --git a/ChangeLog.md b/ChangeLog.md index 4a4a458..243d460 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -4,12 +4,14 @@ All notable changes to this project will be documented in this file. ---- ## [v1.6.0] - ?? ### Improvements + - Support for Qt6 - Minimum required Qt version is 5.12 - Add case sensitivity option in Stringmatchfilter - cmake: replace BUILD_STATIC_LOG4CXX_LIB with standard BUILD_SHARED_LIBS ### Fixed +- Fixes for Qt6.7 - Replace deprecated Qt 5.15 stuff ## [v1.5.1] - 14.02.2020 diff --git a/src/log4qt/CMakeLists.txt b/src/log4qt/CMakeLists.txt index 4c99e3f..1ba0294 100644 --- a/src/log4qt/CMakeLists.txt +++ b/src/log4qt/CMakeLists.txt @@ -80,6 +80,7 @@ set(log4qt_HEADERS hierarchy.h layout.h level.h + log4qtdefs.h log4qt.h log4qtshared.h log4qtsharedptr.h diff --git a/src/log4qt/appender.h b/src/log4qt/appender.h index b772995..3deae6e 100644 --- a/src/log4qt/appender.h +++ b/src/log4qt/appender.h @@ -22,6 +22,7 @@ #define LOG4QT_APPENDER_H #include "layout.h" +#include "log4qtdefs.h" #include "log4qtsharedptr.h" #include "spi/filter.h" #include "helpers/classlogger.h" diff --git a/src/log4qt/basicconfigurator.h b/src/log4qt/basicconfigurator.h index 178ea1e..84a54b9 100644 --- a/src/log4qt/basicconfigurator.h +++ b/src/log4qt/basicconfigurator.h @@ -21,6 +21,7 @@ #ifndef LOG4QT_BASICCONFIGURATOR_H #define LOG4QT_BASICCONFIGURATOR_H +#include "log4qtdefs.h" #include "log4qt.h" namespace Log4Qt diff --git a/src/log4qt/helpers/configuratorhelper.h b/src/log4qt/helpers/configuratorhelper.h index 2957f79..e6dd3d1 100644 --- a/src/log4qt/helpers/configuratorhelper.h +++ b/src/log4qt/helpers/configuratorhelper.h @@ -21,6 +21,7 @@ #ifndef LOG4QT_HELPERS_CONFIGURATORHELPER_H #define LOG4QT_HELPERS_CONFIGURATORHELPER_H +#include "log4qt/log4qtdefs.h" #include "log4qt/log4qtshared.h" #include "log4qt/loggingevent.h" diff --git a/src/log4qt/helpers/factory.h b/src/log4qt/helpers/factory.h index 6b2b067..8c3d8f7 100644 --- a/src/log4qt/helpers/factory.h +++ b/src/log4qt/helpers/factory.h @@ -21,6 +21,7 @@ #ifndef LOG4QT_HELPERS_FACTORY_H #define LOG4QT_HELPERS_FACTORY_H +#include "log4qt/log4qtdefs.h" #include "log4qt/log4qtshared.h" #include diff --git a/src/log4qt/helpers/initialisationhelper.h b/src/log4qt/helpers/initialisationhelper.h index 5059dfb..e7f36bb 100644 --- a/src/log4qt/helpers/initialisationhelper.h +++ b/src/log4qt/helpers/initialisationhelper.h @@ -21,6 +21,7 @@ #ifndef LOG4QT_HELPERS_INITIALISATIONHELPER_H #define LOG4QT_HELPERS_INITIALISATIONHELPER_H +#include "log4qt/log4qtdefs.h" #include "log4qt/log4qtshared.h" #include diff --git a/src/log4qt/helpers/optionconverter.h b/src/log4qt/helpers/optionconverter.h index 95cf569..a8be5f7 100644 --- a/src/log4qt/helpers/optionconverter.h +++ b/src/log4qt/helpers/optionconverter.h @@ -21,6 +21,7 @@ #ifndef LOG4QT_OPTIONCONVERTER_H #define LOG4QT_OPTIONCONVERTER_H +#include "log4qt/log4qtdefs.h" #include "log4qt/log4qtshared.h" #include "log4qt/level.h" diff --git a/src/log4qt/helpers/patternformatter.h b/src/log4qt/helpers/patternformatter.h index 4335dd0..2e152ac 100644 --- a/src/log4qt/helpers/patternformatter.h +++ b/src/log4qt/helpers/patternformatter.h @@ -21,6 +21,7 @@ #ifndef LOG4QT_PATTERNFORMATTER_H #define LOG4QT_PATTERNFORMATTER_H +#include "log4qt/log4qtdefs.h" #include "log4qt/log4qtshared.h" #include diff --git a/src/log4qt/layout.h b/src/log4qt/layout.h index ec09b1d..0c6acdb 100644 --- a/src/log4qt/layout.h +++ b/src/log4qt/layout.h @@ -21,6 +21,7 @@ #ifndef LOG4QT_LAYOUT_H #define LOG4QT_LAYOUT_H +#include "log4qtdefs.h" #include "log4qt.h" #include "log4qtsharedptr.h" diff --git a/src/log4qt/log4qt.h b/src/log4qt/log4qt.h index 37d7f1e..ef233be 100644 --- a/src/log4qt/log4qt.h +++ b/src/log4qt/log4qt.h @@ -475,12 +475,6 @@ # error "Log4Qt requires at least clang version 3.3 or higher for used c++11 features" #endif -// use Q_DISABLE_COPY for Qt version prior to 5.13.0 -#ifndef Q_DISABLE_COPY_MOVE -#define Q_DISABLE_COPY_MOVE(Class) \ -Q_DISABLE_COPY(Class) -#endif - /* LOG4QT_VERSION is (major << 16) + (minor << 8) + patch. */ diff --git a/src/log4qt/log4qtdefs.h b/src/log4qt/log4qtdefs.h new file mode 100644 index 0000000..1d3c78f --- /dev/null +++ b/src/log4qt/log4qtdefs.h @@ -0,0 +1,16 @@ +#ifndef LOG4QTDEFS_H +#define LOG4QTDEFS_H + +#include + +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +#include +#endif + +// use Q_DISABLE_COPY for Qt version prior to 5.13.0 +#ifndef Q_DISABLE_COPY_MOVE +#define Q_DISABLE_COPY_MOVE(Class) \ +Q_DISABLE_COPY(Class) +#endif + +#endif // LOG4QTDEFS_H diff --git a/src/log4qt/mdc.h b/src/log4qt/mdc.h index 6ac88a0..5cb19b2 100644 --- a/src/log4qt/mdc.h +++ b/src/log4qt/mdc.h @@ -21,6 +21,7 @@ #ifndef LOG4QT_MDC_H #define LOG4QT_MDC_H +#include "log4qtdefs.h" #include "log4qt.h" #include diff --git a/src/log4qt/ndc.h b/src/log4qt/ndc.h index 25dfd0a..b817566 100644 --- a/src/log4qt/ndc.h +++ b/src/log4qt/ndc.h @@ -21,7 +21,8 @@ #ifndef LOG4QT_NDC_H #define LOG4QT_NDC_H -#include "log4qt.h" +#include "log4qtdefs.h" +#include "log4qtshared.h" #include #include