QCustomPlot Discussion and Comments

QT 6.2 patchReturn to overview

if anyone needs this is the patch to make QCustomPlot 2.1 amalgamated (from download page) compile with QT 6.2

@DerManu:
your old trick doesnt work anymore in the qt 6.2, so ifdef this version with the one you have.
this works with QT 5.8+

Only in qcustomplot: changelog.txt
Only in qcustomplot: documentation
Only in qcustomplot: examples
Only in qcustomplot: GPL.txt
diff -u qcustomplot/unpatched/qcustomplot.h qcustomplot/qcustomplot.h
--- qcustomplot/unpatched/qcustomplot.h	2021-09-07 22:38:29.333639801 +0200
+++ qcustomplot/qcustomplot.h	2021-10-03 17:30:21.411847294 +0200
@@ -156,26 +156,8 @@
   
   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 @@
                      ,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::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' */
 
Only in qcustomplot: unpatched

Dear Miccs,

Can you explain how and where to apply this patch? Thanks a lot!

Kind regards, Jan

here you can download patched - ready to use file:
https://www.mediafire.com/file/v8x4f15isj0nq45/qcustomplot.h/file

if you are scared of the contents of downloaded files just check its content by comparing the contents of this file with the original unmodified using for example total commander (on windows) or double commander / krusader on linux.

you can apply that patch yourself - but i cannot give you exact command(probably you are on windows) - git client can do it (from what i know) or other port of patch tool from linux.

on linux its simple -
patch -p2 < ../qcustomplot.patch

thats it.
google for a windows solution - its a "diff patch"

Dear Miccs

Thank you for this patch, it works perfect now