From fc642b6cac4c9300fec10b79e9b7c41cca4c8b1c Mon Sep 17 00:00:00 2001 From: jkriege2 Date: Thu, 23 Mar 2023 14:53:23 +0100 Subject: [PATCH] bugfixed QSet-initialization --- examples/second_axis/README.md | 1 + lib/jkqtplotter/jkqtpbaseplotter.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/second_axis/README.md b/examples/second_axis/README.md index 866303c8b8..d8b928236d 100644 --- a/examples/second_axis/README.md +++ b/examples/second_axis/README.md @@ -131,5 +131,6 @@ If we set seondary axes for the x-axis instead of the y-axis, i.e. use // ... ``` we get a plot like this: + ![second_axis_hor](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/second_axis_hor.png) diff --git a/lib/jkqtplotter/jkqtpbaseplotter.cpp b/lib/jkqtplotter/jkqtpbaseplotter.cpp index 80503f4f42..c756abf540 100644 --- a/lib/jkqtplotter/jkqtpbaseplotter.cpp +++ b/lib/jkqtplotter/jkqtpbaseplotter.cpp @@ -3337,14 +3337,20 @@ bool JKQTBasePlotter::hasYAxis(JKQTPCoordinateAxisRef axis) const QSet JKQTBasePlotter::getAvailableXAxisRefs(bool includePrimary) const { - QSet res(secondaryXAxis.keyBegin(),secondaryXAxis.keyEnd()); + QSet res; + for (auto it=secondaryXAxis.begin(); it!=secondaryXAxis.end(); ++it) { + res.insert(it.key()); + } if (includePrimary) res.insert(JKQTPPrimaryAxis); return res; } QSet JKQTBasePlotter::getAvailableYAxisRefs(bool includePrimary) const { - QSet res(secondaryYAxis.keyBegin(),secondaryYAxis.keyEnd()); + QSet res; + for (auto it=secondaryYAxis.begin(); it!=secondaryYAxis.end(); ++it) { + res.insert(it.key()); + } if (includePrimary) res.insert(JKQTPPrimaryAxis); return res; }