From 97844ad1e546295248c311db4f4d28f071245c50 Mon Sep 17 00:00:00 2001 From: Ludovic LANGE Date: Sat, 24 Sep 2022 22:22:15 +0200 Subject: [PATCH] make QCustomPlot compatible with Qt6.2+ (qt6) Cf the discussion here: https://www.qcustomplot.com/index.php/support/forum/2380 --- qcustomplot.h | 44 ++++++++++++++++---------------------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/qcustomplot.h b/qcustomplot.h index 8f0f78b..170850b 100644 --- a/qcustomplot.h +++ b/qcustomplot.h @@ -156,26 +156,8 @@ class QCPPolarGraph; It provides QMetaObject-based reflection of its enums and flags via \a QCP::staticMetaObject. */ -#ifndef Q_MOC_RUN namespace QCP { -#else -class QCP { // when in moc-run, make it look like a class, so we get Q_GADGET, Q_ENUMS/Q_FLAGS features in namespace - Q_GADGET - Q_ENUMS(ExportPen) - Q_ENUMS(ResolutionUnit) - Q_ENUMS(SignDomain) - Q_ENUMS(MarginSide) - Q_FLAGS(MarginSides) - Q_ENUMS(AntialiasedElement) - Q_FLAGS(AntialiasedElements) - Q_ENUMS(PlottingHint) - Q_FLAGS(PlottingHints) - Q_ENUMS(Interaction) - Q_FLAGS(Interactions) - Q_ENUMS(SelectionRectMode) - Q_ENUMS(SelectionType) -public: -#endif + Q_NAMESPACE /*! Defines the different units in which the image resolution can be specified in the export @@ -318,6 +300,20 @@ enum SelectionType { stNone ///< The plottable is not selectable ,stMultipleDataRanges ///< Any combination of data points/ranges can be selected }; + Q_ENUM_NS(ExportPen) + Q_ENUM_NS(ResolutionUnit) + Q_ENUM_NS(SignDomain) + Q_ENUM_NS(MarginSide) + Q_FLAG_NS(MarginSides) + Q_ENUM_NS(AntialiasedElement) + Q_FLAG_NS(AntialiasedElements) + Q_ENUM_NS(PlottingHint) + Q_FLAG_NS(PlottingHints) + Q_ENUM_NS(Interaction) + Q_FLAG_NS(Interactions) + Q_ENUM_NS(SelectionRectMode) + Q_ENUM_NS(SelectionType) + /*! \internal Returns whether the specified \a value is considered an invalid data value for plottables (i.e. @@ -386,15 +382,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::AntialiasedElements) Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::PlottingHints) Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::MarginSides) Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::Interactions) -Q_DECLARE_METATYPE(QCP::ExportPen) -Q_DECLARE_METATYPE(QCP::ResolutionUnit) -Q_DECLARE_METATYPE(QCP::SignDomain) -Q_DECLARE_METATYPE(QCP::MarginSide) -Q_DECLARE_METATYPE(QCP::AntialiasedElement) -Q_DECLARE_METATYPE(QCP::PlottingHint) -Q_DECLARE_METATYPE(QCP::Interaction) -Q_DECLARE_METATYPE(QCP::SelectionRectMode) -Q_DECLARE_METATYPE(QCP::SelectionType) +//no need to use Q_DECLARE_METATYPE on enum since Q_ENUM_NS adds enum as metatype automatically /* end of 'src/global.h' */