diff --git a/CMakeLists.txt b/CMakeLists.txt
index e431a08726..10c1044377 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,6 +19,9 @@ endif()
if(NOT DEFINED BUILD_DECORATE_LIBNAMES_WITH_BUILDTYPE)
option(BUILD_DECORATE_LIBNAMES_WITH_BUILDTYPE "If set, the build-type is appended to the library name" ON)
endif()
+if(NOT DEFINED BUILD_HIGH_COMPILE_WARNING_LEVEL)
+ option(BUILD_HIGH_COMPILE_WARNING_LEVEL "Set Compiler Warning level to high" OFF)
+endif()
if(NOT DEFINED BUILD_EXAMPLES)
option(BUILD_EXAMPLES "Build examples" ON)
endif()
@@ -77,14 +80,9 @@ find_package(Qt5 5.0 REQUIRED Core Gui Widgets PrintSupport Svg Xml OpenGl)
set (CMAKE_CXX_STANDARD 11)
+set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
if(MSVC)
- if(BUILD_SHARED_LIBS)
- set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
- endif()
- set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
- set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
-
add_compile_options(/EHsc)
# To enable M_PI, M_E,...
add_definitions(/D_USE_MATH_DEFINES)
@@ -95,6 +93,9 @@ if(MSVC)
add_definitions(/D_CRT_NO_VA_START_VALIDATION)
else()
add_compile_options(-fexceptions)
+ if(BUILD_HIGH_COMPILE_WARNING_LEVEL)
+ add_compile_options(-Wall -Wextra) # -Wimplicit-fallthrough -Wuninitialized -Wmaybe-uninitialized) # -Wmisleading-indentation -Weffc++)
+ endif(BUILD_HIGH_COMPILE_WARNING_LEVEL)
endif()
if(BUILD_INCLUDE_XITS_FONTS)
diff --git a/JKQtPlotterBuildAllExamples.pro b/JKQtPlotterBuildAllExamples.pro
index 5f442e7a51..4fc779db0e 100644
--- a/JKQtPlotterBuildAllExamples.pro
+++ b/JKQtPlotterBuildAllExamples.pro
@@ -33,9 +33,6 @@ jkqtmathtext_simpletest.depends = jkqtmathtextlib
jkqtmathtext_test.subdir = examples/jkqtmathtext_test
jkqtmathtext_test.depends = jkqtplotterlib
-jkqtplot_test.subdir = examples/jkqtplot_test
-jkqtplot_test.depends = jkqtplotterlib
-
jkqtplotter_simpletest.file = examples/simpletest/jkqtplotter_simpletest.pro
jkqtplotter_simpletest.depends = jkqtplotterlib
diff --git a/appveyor.yml b/appveyor.yml
index 849b31ee2f..459e2be16b 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -8,9 +8,20 @@ environment:
QTVER: 5.11
JOMDIR: C:\Qt\Tools\QtCreator\bin
MINGWDIR: C:\Qt\Tools\mingw530_32
-
+ VSVER: 0
matrix:
+ - QTABI: mingw53_32
+ ARCH: x86
+ MAKETOOL: mingw32-make
+ CMAKE_GENERATOR: "MinGW Makefiles"
+ USE_CMAKE: true
+ MSBUILD_FLAGS:
+ - QTABI: mingw53_32
+ ARCH: x86
+ QMAKESPEC: win32-g++
+ MAKETOOL: mingw32-make
+ USE_CMAKE: false
- QTABI: msvc2017_64
ARCH: x64
VSVER: 2017
@@ -35,17 +46,6 @@ environment:
QMAKESPEC: win32-msvc
MAKETOOL: jom
USE_CMAKE: false
- - QTABI: mingw53_32
- ARCH: x86
- MAKETOOL: mingw32-make
- CMAKE_GENERATOR: "MinGW Makefiles"
- USE_CMAKE: true
- MSBUILD_FLAGS:
- - QTABI: mingw53_32
- ARCH: x86
- QMAKESPEC: win32-g++
- MAKETOOL: mingw32-make
- USE_CMAKE: false
skip_tags: true
@@ -57,6 +57,7 @@ configuration:
- release
- debug
+
install:
- IF %VSVER% GTR 14 (
call "C:\Program Files (x86)\Microsoft Visual Studio\%VSVER%\Community\VC\Auxiliary\Build\vcvarsall.bat" %ARCH%
@@ -69,6 +70,8 @@ install:
)
- set PATH=C:\Qt\%QTVER%\%QTABI%\bin;%JOMDIR%;%PATH%
- echo "BUILD ID Qt%QTVER%_%QTABI%_%APPVEYOR_BUILD_VERSION%_%CONFIGURATION%"
+ # Rename sh.exe as sh.exe in PATH interferes with MinGW
+ - rename "C:\Program Files\Git\usr\bin\sh.exe" "sh2.exe"
build_script:
# - dir "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include"
@@ -83,7 +86,7 @@ build_script:
cmake --version &&
cmake -G "%CMAKE_GENERATOR%" "-DCMAKE_PREFIX_PATH=%QT5%" .. &&
echo "Build..." &&
- cmake --build --config "%CMAKE_CONFIGURATION%" -- %MSBUILD_FLAGS% )
+ cmake --build . --config "%CMAKE_CONFIGURATION%" -- %MSBUILD_FLAGS% )
else (
echo "Call QMake..." &&
qmake.exe -v &&
diff --git a/doc/dox/buildinstructions.dox b/doc/dox/buildinstructions.dox
index 586bbe6170..bd561ec9a4 100644
--- a/doc/dox/buildinstructions.dox
+++ b/doc/dox/buildinstructions.dox
@@ -12,6 +12,7 @@ The preferred way to build JKQTPlotter is using CMake. The CMake-build is define
You can build JKQTPlotter (and also the examples) by:
- Either opening the file CMakeLists.txt in QTCreator (which has CMake integration)
- Or by calling something like this from the source directory:
+
\code{.sh}
$ mkdir build; cd build
$ cmake ../
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 915012d96b..7223e7c7db 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -10,6 +10,7 @@ add_subdirectory(jkqtfastplotter_test)
add_subdirectory(jkqtmathtext_simpletest)
add_subdirectory(jkqtmathtext_test)
+add_subdirectory(jkqtplot_test)
add_subdirectory(advplotstyling)
add_subdirectory(barchart)
diff --git a/examples/contourplot/contourplotanimator.cpp b/examples/contourplot/contourplotanimator.cpp
index cbbc2cbb56..c39617cf0e 100644
--- a/examples/contourplot/contourplotanimator.cpp
+++ b/examples/contourplot/contourplotanimator.cpp
@@ -30,9 +30,9 @@ void ContourPlotAnimator::step() {
const double Q4=-1.6e-19; // charge of charged particle 4
const double Q4_x0=r2*cos(angle); // x-position of charged particle 4
const double Q4_y0=-r2*sin(angle); // y-position of charged particle 4
- for (size_t iy=0; iy(NY); iy++ ) {
x=-w/2.0;
- for (size_t ix=0; ix(NX); ix++ ) {
const double r1=sqrt((x-Q1_x0)*(x-Q1_x0)+(y-Q1_y0)*(y-Q1_y0));
const double r2=sqrt((x-Q2_x0)*(x-Q2_x0)+(y-Q2_y0)*(y-Q2_y0));
const double r3=sqrt((x-Q3_x0)*(x-Q3_x0)+(y-Q3_y0)*(y-Q3_y0));
diff --git a/examples/datastore_iterators/datastore_iterators.cpp b/examples/datastore_iterators/datastore_iterators.cpp
index f9afcc7c04..52f632a563 100644
--- a/examples/datastore_iterators/datastore_iterators.cpp
+++ b/examples/datastore_iterators/datastore_iterators.cpp
@@ -40,8 +40,10 @@ int main(int argc, char* argv[])
auto biXCol=datastore->backInserter(XCol);
auto biYCol=datastore->backInserter(YCol);
for (double x=0; x<4.0*M_PI; x+=4.0*M_PI/50.0) {
- *++biXCol=x;
- *++biYCol=cos(x);
+ *biXCol=x;
+ *biYCol=cos(x);
+ ++biXCol;
+ ++biYCol;
}
// 2.3 combining with addLinearColumn() you can also use C++ STL algorithms:
//size_t XCol=datastore->addLinearColumn(50, 0, 4.0*M_PI, "cos curve: x-data");
diff --git a/examples/jkqtfastplotter_test/jkqtfastplotter_test_testmain.cpp b/examples/jkqtfastplotter_test/jkqtfastplotter_test_testmain.cpp
index 2532e4afa0..1d1f275d0a 100644
--- a/examples/jkqtfastplotter_test/jkqtfastplotter_test_testmain.cpp
+++ b/examples/jkqtfastplotter_test/jkqtfastplotter_test_testmain.cpp
@@ -23,7 +23,7 @@ TestMain::TestMain(QWidget *parent) :
y3=(double*)calloc(N1, sizeof(double));
- QGridLayout* gl=new QGridLayout(this);
+ QGridLayout* gl=new QGridLayout();
setLayout(gl);
QTabWidget* t=new QTabWidget(this);
gl->addWidget(t,0,0);
diff --git a/examples/jkqtplot_test/CMakeLists.txt b/examples/jkqtplot_test/CMakeLists.txt
new file mode 100644
index 0000000000..edab62ee9c
--- /dev/null
+++ b/examples/jkqtplot_test/CMakeLists.txt
@@ -0,0 +1,38 @@
+cmake_minimum_required(VERSION 3.0)
+
+set(EXAMPLE_NAME jkqtplot_test)
+set(EXENAME ${EXAMPLE_NAME})
+
+message( STATUS ".. Building Example ${EXAMPLE_NAME}" )
+
+
+# Set up source files
+set(SOURCES jkqtplot_test.cpp testmain.cpp TestWidgetBarcharts.cpp TestWidgetContourPlots.cpp TestWidgetEmptyPlot.cpp TestWidgetFunctionPlots.cpp TestWidgetGeometry.cpp TestWidgetGraphs.cpp TestWidgetImages.cpp TestWidgetLogGraphs.cpp TestWidgetParamScatterPlots.cpp TestWidgetPeaksPlots.cpp TestWidgetRGBImages.cpp )
+# EmfEngine/src/EmfEngine.cpp
+# EmfEngine/src/EmfPaintDevice.cpp
+# QTeXEngine/src/QTeXPaintDevice.h
+# QTeXEngine/src/QTeXPaintEngine.h
+#)
+set(HEADERS testmain.h TestWidgetBarcharts.h TestWidgetContourPlots.h TestWidgetEmptyPlot.h TestWidgetFunctionPlots.h TestWidgetGeometry.h TestWidgetGraphs.h TestWidgetImages.h TestWidgetLogGraphs.h TestWidgetParamScatterPlots.h TestWidgetPeaksPlots.h TestWidgetRGBImages.h)
+# jkqtpemfengineadapter.h
+
+# EmfEngine/src/EmfEngine.h
+# QTeXEngine/src/QTeXEngine.h
+#)
+set(RESOURCES jkqtplot_test.qrc )
+set(UIS )
+
+add_executable(${EXENAME} WIN32 ${SOURCES} ${HEADERS} ${RESOURCES} ${UIS})
+target_include_directories(${EXENAME} PRIVATE ../../lib)
+if(BUILD_STATIC_LIBS)
+ target_link_libraries(${EXENAME} JKQTPlotterLib${LIBNAME_ADDITION})
+elseif(BUILD_SHARED_LIBS)
+ target_link_libraries(${EXENAME} JKQTPlotterSharedLib${LIBNAME_ADDITION})
+endif()
+
+
+
+# Installation
+if(LIB_INSTALL)
+ install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+endif(LIB_INSTALL)
diff --git a/examples/jkqtplot_test/TestWidgetBarcharts.cpp b/examples/jkqtplot_test/TestWidgetBarcharts.cpp
index 3207f71b76..7b2040fe98 100644
--- a/examples/jkqtplot_test/TestWidgetBarcharts.cpp
+++ b/examples/jkqtplot_test/TestWidgetBarcharts.cpp
@@ -14,7 +14,7 @@ TestWidgetBarcharts::TestWidgetBarcharts(QWidget *parent) :
{
- QVBoxLayout* barchartLayout=new QVBoxLayout(this);
+ QVBoxLayout* barchartLayout=new QVBoxLayout();
setLayout(barchartLayout);
resize(1000, 800);
plotBarchart=new JKQTPlotter(true, this);
diff --git a/examples/jkqtplot_test/TestWidgetContourPlots.cpp b/examples/jkqtplot_test/TestWidgetContourPlots.cpp
index 658265ed8e..a83a20d6d5 100644
--- a/examples/jkqtplot_test/TestWidgetContourPlots.cpp
+++ b/examples/jkqtplot_test/TestWidgetContourPlots.cpp
@@ -14,7 +14,7 @@ TestWidgetContourPlots::TestWidgetContourPlots(QWidget *parent) :
// contour plot
- QHBoxLayout* layoutContour=new QHBoxLayout(this);
+ QHBoxLayout* layoutContour=new QHBoxLayout();
setLayout(layoutContour);
JKQTPlotter* plotContour=new JKQTPlotter(true, this);
plotContour->setPlotUpdateEnabled(false);
diff --git a/examples/jkqtplot_test/TestWidgetFunctionPlots.cpp b/examples/jkqtplot_test/TestWidgetFunctionPlots.cpp
index ab1049b348..7995e9c73b 100644
--- a/examples/jkqtplot_test/TestWidgetFunctionPlots.cpp
+++ b/examples/jkqtplot_test/TestWidgetFunctionPlots.cpp
@@ -14,7 +14,7 @@ TestWidgetFunctionPlots::TestWidgetFunctionPlots(QWidget *parent) :
{
- QVBoxLayout* plotFuncLayout=new QVBoxLayout(this);
+ QVBoxLayout* plotFuncLayout=new QVBoxLayout();
setLayout(plotFuncLayout);
plotFuncPlt=new JKQTPlotter(true, this);
plotFuncLayout->addWidget(plotFuncPlt);
diff --git a/examples/jkqtplot_test/TestWidgetGeometry.cpp b/examples/jkqtplot_test/TestWidgetGeometry.cpp
index 26ebf2a45c..1f8dec7fcf 100644
--- a/examples/jkqtplot_test/TestWidgetGeometry.cpp
+++ b/examples/jkqtplot_test/TestWidgetGeometry.cpp
@@ -12,7 +12,7 @@ TestWidgetGeometry::TestWidgetGeometry(QWidget *parent) :
QWidget(parent)
{
// create third plotter with output of a geometric drawing
- QVBoxLayout* layout1=new QVBoxLayout(this);
+ QVBoxLayout* layout1=new QVBoxLayout();
setLayout(layout1);
resize(1000, 800);
JKQTPlotter* plotGeo=new JKQTPlotter(true, this);
@@ -36,16 +36,16 @@ TestWidgetGeometry::TestWidgetGeometry(QWidget *parent) :
//plotGeo->getPlotter()->addGraph(line2);
JKQTPGeoRectangle* rect1=new JKQTPGeoRectangle(plotGeo->getPlotter(), 1,1,2,2, QColor("blue"),2, Qt::SolidLine, QColor("lightblue"));
- rect1->setAngle(30);
+ rect1->setAngle(30);
//plotGeo->getPlotter()->addGraph(rect1);
JKQTPGeoRectangle* rect2=new JKQTPGeoRectangle(plotGeo->getPlotter(), 1,1,2,2, QColor("red"),2);
- rect2->setAngle(45);
+ rect2->setAngle(45);
//plotGeo->getPlotter()->addGraph(rect2);
JKQTPGeoRectangle* rect3=new JKQTPGeoRectangle(plotGeo->getPlotter(), 1,1,2,4, QColor("green"),2);
- rect3->setAngle(-30);
+ rect3->setAngle(-30);
//plotGeo->getPlotter()->addGraph(rect3);
JKQTPGeoEllipse* ell3=new JKQTPGeoEllipse(plotGeo->getPlotter(), 1,1,2,4, QColor("green"),2, Qt::SolidLine, QColor("lightgreen"), Qt::CrossPattern);
- ell3->setAngle(-30);
+ ell3->setAngle(-30);
//plotGeo->getPlotter()->addGraph(ell3);
QVector p;
@@ -57,7 +57,7 @@ TestWidgetGeometry::TestWidgetGeometry(QWidget *parent) :
// JKQTPGeoPolygon* poly=new JKQTPGeoPolygon(plotGeo->getPlotter(), p, QColor("black"), 1.5, Qt::SolidLine, QColor(128,128,0,128));
//plotGeo->getPlotter()->addGraph(poly);
-// JKQTPGeoPolyLines* lines=new JKQTPGeoPolyLines(plotGeo->getPlotter(), p, QColor(255,255,0), 3);
+// JKQTPGeoPolyLines* lines=new JKQTPGeoPolyLines(plotGeo->getPlotter(), p, QColor(255,255,0), 3);
//plotGeo->getPlotter()->addGraph(lines);
JKQTPGeoEllipse* ell1=new JKQTPGeoEllipse(plotGeo->getPlotter(), 0,0,2,4, QColor("black"),1.5, Qt::DotLine);
diff --git a/examples/jkqtplot_test/TestWidgetGraphs.cpp b/examples/jkqtplot_test/TestWidgetGraphs.cpp
index 76b1791a0c..304fb42633 100644
--- a/examples/jkqtplot_test/TestWidgetGraphs.cpp
+++ b/examples/jkqtplot_test/TestWidgetGraphs.cpp
@@ -4,6 +4,7 @@
#include
#include
#include "jkqtplotter/graphs/jkqtpscatter.h"
+#include "jkqtplotter/graphs/jkqtpbarchart.h"
#include "jkqtplotter/graphs/jkqtpboxplot.h"
#include "jkqtplotter/graphs/jkqtpfilledcurve.h"
#include "jkqtplotter/gui/jkqtpcomboboxes.h"
@@ -36,8 +37,8 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
QListView* listPlots=new QListView(this);
listPlots->setModel(plot->getPlotter()->getPlotsModel());
listPlots->setMaximumWidth(256);
- QVBoxLayout* layout=new QVBoxLayout(this);
- QGridLayout* layout_grid=new QGridLayout(this);
+ QVBoxLayout* layout=new QVBoxLayout();
+ QGridLayout* layout_grid=new QGridLayout();
layout_grid->addWidget(plot,0,0,1,1);
layout_grid->addWidget(plotBot,1,0,1,1);
layout_grid->addWidget(listPlots,0,1,1,1);
@@ -47,7 +48,7 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
setLayout(layout);
resize(1000, 800);
- plotBot->synchronizeToMaster(plot, JKQTBasePlotter::sdXAxis, true, true, true);
+ plotBot->synchronizeXToMaster(plot);
plot->getPlotter()->setGridPrinting(true);
plot->getPlotter()->addGridPrintingPlotter(0,1,plotBot->getPlotter());
plot->getPlotter()->addGridPrintingPlotter(0,2,plotBot2->getPlotter());
@@ -103,16 +104,30 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
size_t cy21re=ds->addColumn(y21re, N2, "y21re");
- size_t id=plot->getPlotter()->addGraph(cx2, cy21, "$5\\cdot\\sin(x)$", JKQTPFilledCurveX);
- JKQTPFilledCurveXGraph* fcxgr=qobject_cast(plot->getPlotter()->getGraph(id));
+ JKQTPFilledCurveXGraph* fcxgr;
+ size_t id=plot->getPlotter()->addGraph(fcxgr=new JKQTPFilledCurveXGraph(plot));
+ fcxgr->setXColumn(cx2);
+ fcxgr->setYColumn(cy21);
+ fcxgr->setTitle("$5\\cdot\\sin(x)$");
+ qobject_cast(plot->getPlotter()->getGraph(id));
if (fcxgr) {
fcxgr->setBaseline(2);
}
- size_t yeb=plot->getPlotter()->addGraphWithXYError(cx2, cy21, cy22, cy22, "sine with errors", JKQTPFilledCurveX);
+ JKQTPFilledCurveXErrorGraph* gELines;
+ size_t yeb=plot->getPlotter()->addGraph(gELines=new JKQTPFilledCurveXErrorGraph(plot));
+ gELines->setXColumn(cx2);
+ gELines->setYErrorColumnLower(cy22);
+ gELines->setYColumn(cy22);
+ gELines->setYErrorColumn(cy21);
+ gELines->setTitle("sine with errors");
plteErrors=plot->getPlotter()->getGraph(yeb);
setErrorLineStyle(0);
- yeb=plot->getPlotter()->addGraph(cx2, cy21, "$5\\cdot\\sin(x)$", JKQTPLinesPoints);
+ JKQTPXYLineGraph* gLines;
+ yeb=plot->getPlotter()->addGraph(gLines=new JKQTPXYLineGraph(plot));
+ gLines->setXColumn(cx2);
+ gLines->setYColumn(cy21);
+ gLines->setTitle("$5\\cdot\\sin(x)$");
plteSymbols=plot->getPlotter()->getGraph(yeb);
pltePlot2=new JKQTPXYLineErrorGraph(plotBot->getPlotter());
@@ -120,7 +135,7 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
pltePlot2->setYColumn(cy21r);
pltePlot2->setTitle(tr("random numbers"));
pltePlot2->setDrawLine(true);
- pltePlot2->setYErrorColumn(cy21re);
+ pltePlot2->setYErrorColumn(static_cast(cy21re));
pltePlot2->setYErrorStyle(JKQTPErrorBarsPolygons);
pltePlot2->setSymbolType(JKQTPFilledStar);
plotBot->getPlotter()->addGraph(pltePlot2);
@@ -161,7 +176,33 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
cb.push_back(ds->addColumn(b3, N3, "b3"));
QStringList ts;
ts<<"bars 1"<<"bars 2"<<"bars 3";
- plot->getPlotter()->addVerticalBargraph(cb, cbp, ts);
+ JKQTPBarVerticalGraph* gbar1;
+ JKQTPBarVerticalGraph* gbar2;
+ JKQTPBarVerticalGraph* gbar3;
+ double w=0.9;
+ double width=w/static_cast(3);
+ double s=-1.0*w/2.0+width/2.0;
+ plot->getPlotter()->addGraph(gbar1=new JKQTPBarVerticalGraph(plot));
+ gbar1->setXColumn(cbp);
+ gbar1->setYColumn(cb[0]);
+ gbar1->setTitle(ts[0]);
+ gbar1->setShift(s);
+ gbar1->setWidth(width);
+ s=s+width;
+ plot->getPlotter()->addGraph(gbar2=new JKQTPBarVerticalGraph(plot));
+ gbar2->setXColumn(cbp);
+ gbar2->setYColumn(cb[1]);
+ gbar2->setTitle(ts[1]);
+ gbar2->setShift(s);
+ gbar2->setWidth(width);
+ s=s+width;
+ plot->getPlotter()->addGraph(gbar3=new JKQTPBarVerticalGraph(plot));
+ gbar3->setXColumn(cbp);
+ gbar3->setYColumn(cb[2]);
+ gbar3->setTitle(ts[2]);
+ gbar3->setShift(s);
+ gbar3->setWidth(width);
+ s=s+width;
JKQTPVerticalRange* r1=new JKQTPVerticalRange(plot->getPlotter());
r1->setRangeMin(5);
diff --git a/examples/jkqtplot_test/TestWidgetGraphs.h b/examples/jkqtplot_test/TestWidgetGraphs.h
index 2252568315..b4cfff7262 100644
--- a/examples/jkqtplot_test/TestWidgetGraphs.h
+++ b/examples/jkqtplot_test/TestWidgetGraphs.h
@@ -30,7 +30,7 @@ class TestWidgetGraphs : public QWidget
{
Q_OBJECT
public:
- explicit TestWidgetGraphs(QWidget *parent = 0);
+ explicit TestWidgetGraphs(QWidget *parent = nullptr);
signals:
@@ -47,8 +47,8 @@ class TestWidgetGraphs : public QWidget
void setKeyPos2(JKQTPKeyPosition layout);
protected:
- double x1[N1], x2[N2], x2r[N2]/*, x3[N3]*/;
- double y11[N1], y12[N1], y13[N1], y21[N2], y21r[N2], y21re[N2], y22[N2], y23[N2], y24[N2];
+ double x1[N1], x2[N2], x2r[N1]/*, x3[N3]*/;
+ double y11[N1], y12[N1], y13[N1], y21[N1], y21r[N1], y21re[N1], y22[N1], y23[N1], y24[N1];
double xbox[N3], ymed[N3], ymean[N3], ymin[N3], ymax[N3], yp25[N3], yp75[N3];
double b1[N3], b2[N3], b3[N3];
diff --git a/examples/jkqtplot_test/TestWidgetImages.cpp b/examples/jkqtplot_test/TestWidgetImages.cpp
index 314e647f7d..3159a2f0b9 100644
--- a/examples/jkqtplot_test/TestWidgetImages.cpp
+++ b/examples/jkqtplot_test/TestWidgetImages.cpp
@@ -17,7 +17,7 @@ TestWidgetImages::TestWidgetImages(QWidget *parent) :
QWidget(parent)
{
- QVBoxLayout* layouti=new QVBoxLayout(this);
+ QVBoxLayout* layouti=new QVBoxLayout();
QFormLayout* layWid=new QFormLayout;
layouti->addLayout(layWid);
setLayout(layouti);
diff --git a/examples/jkqtplot_test/TestWidgetLogGraphs.cpp b/examples/jkqtplot_test/TestWidgetLogGraphs.cpp
index 3512d83060..c3349d47d3 100644
--- a/examples/jkqtplot_test/TestWidgetLogGraphs.cpp
+++ b/examples/jkqtplot_test/TestWidgetLogGraphs.cpp
@@ -38,7 +38,11 @@ TestWidgetLogGraphs::TestWidgetLogGraphs(QWidget *parent) :
resize(1000, 800);
- plotLOG->getPlotter()->addGraph(cx2, cy23, "data, $f(x)=5^{x/5}$", JKQTPLines);
+ JKQTPXYLineGraph* gLines;
+ plotLOG->getPlotter()->addGraph(gLines=new JKQTPXYLineGraph(plotLOG));
+ gLines->setXColumn(cx2);
+ gLines->setYColumn(cy23);
+ gLines->setTitle("data, $f(x)=5^{x/5}$");
plotLOG->setPlotUpdateEnabled(true);
diff --git a/examples/jkqtplot_test/TestWidgetParamScatterPlots.cpp b/examples/jkqtplot_test/TestWidgetParamScatterPlots.cpp
index 6bf83c228d..711f80cdae 100644
--- a/examples/jkqtplot_test/TestWidgetParamScatterPlots.cpp
+++ b/examples/jkqtplot_test/TestWidgetParamScatterPlots.cpp
@@ -13,7 +13,7 @@ TestWidgetParamScatterPlots::TestWidgetParamScatterPlots(QWidget *parent) :
QWidget(parent)
{
- QVBoxLayout* layoutPSP=new QVBoxLayout(this);
+ QVBoxLayout* layoutPSP=new QVBoxLayout();
setLayout(layoutPSP);
resize(1000, 800);
diff --git a/examples/jkqtplot_test/TestWidgetPeaksPlots.cpp b/examples/jkqtplot_test/TestWidgetPeaksPlots.cpp
index 38769bdf7a..caa0f48f25 100644
--- a/examples/jkqtplot_test/TestWidgetPeaksPlots.cpp
+++ b/examples/jkqtplot_test/TestWidgetPeaksPlots.cpp
@@ -15,7 +15,7 @@ TestWidgetPeaksPlots::TestWidgetPeaksPlots(QWidget *parent) :
{
- QVBoxLayout* layoutpeaks=new QVBoxLayout(this);
+ QVBoxLayout* layoutpeaks=new QVBoxLayout();
setLayout(layoutpeaks);
resize(1000, 800);
plotPeaks=new JKQTPlotter(true, this);
diff --git a/examples/jkqtplot_test/TestWidgetRGBImages.cpp b/examples/jkqtplot_test/TestWidgetRGBImages.cpp
index d59bc497ea..97dcdb0d20 100644
--- a/examples/jkqtplot_test/TestWidgetRGBImages.cpp
+++ b/examples/jkqtplot_test/TestWidgetRGBImages.cpp
@@ -12,11 +12,10 @@
TestWidgetRGBImages::TestWidgetRGBImages(QWidget *parent) :
QWidget(parent)
{
-
// plotter for images
QWidget* winrgb=new QWidget(this);
- QVBoxLayout* layoutrgb=new QVBoxLayout(this);
- QFormLayout* frm=new QFormLayout(nullptr);
+ QVBoxLayout* layoutrgb=new QVBoxLayout();
+ QFormLayout* frm=new QFormLayout();
winrgb->setLayout(layoutrgb);
winrgb->resize(1000, 800);
plotImgRGB=new JKQTPlotter(true, winrgb);
diff --git a/examples/violinplot/violinplot.cpp b/examples/violinplot/violinplot.cpp
index aa6065223b..e778d35703 100644
--- a/examples/violinplot/violinplot.cpp
+++ b/examples/violinplot/violinplot.cpp
@@ -14,7 +14,7 @@
#include
template
-void showPlot() {
+JKQTPlotter* showPlot() {
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
JKQTPlotter* plot=new JKQTPlotter();
@@ -157,6 +157,8 @@ void showPlot() {
// show plotter and make it a decent size
plot->show();
plot->resize(800,600);
+
+ return plot;
}
int main(int argc, char* argv[])
diff --git a/lib/jkqtcommon/jkqtpdebuggingtools.cpp b/lib/jkqtcommon/jkqtpdebuggingtools.cpp
index 6c2070e058..19d4637b1c 100644
--- a/lib/jkqtcommon/jkqtpdebuggingtools.cpp
+++ b/lib/jkqtcommon/jkqtpdebuggingtools.cpp
@@ -30,12 +30,11 @@ Copyright (c) 2008-2019 Jan W. Krieger ()
int JKQTPAutoOutputTimer::global_indent=0;
-JKQTPAutoOutputTimer::JKQTPAutoOutputTimer(const QString& message) :
- QElapsedTimer()
+JKQTPAutoOutputTimer::JKQTPAutoOutputTimer(const QString& _message) :
+ QElapsedTimer(),message(_message),indent()
{
this->indent=QString(global_indent, QLatin1Char(' '));
global_indent+=4;
- this->message=message;
#if QT_VERSION >= 0x040800
qDebug()<indent<<"TIMER_START: "< epsilon;
+}
+
+/** \brief compare two doubles \a a and \a b for uneuqality, where any difference smaller than \a epsilon is seen as equality
+ * \ingroup jkqtptools_math_basic */
+inline bool jkqtp_approximatelyUnequal(double a, double b, double epsilon=2.0*JKQTP_DOUBLE_EPSILON)
+{
+ return fabs(a - b) > epsilon;
+}
+
/** \brief returns the given value \a v (i.e. identity function)
* \ingroup jkqtptools_math_basic */
template
diff --git a/lib/jkqtcommon/jkqtpstatbasics.h b/lib/jkqtcommon/jkqtpstatbasics.h
index 0e466b065e..f911101133 100644
--- a/lib/jkqtcommon/jkqtpstatbasics.h
+++ b/lib/jkqtcommon/jkqtpstatbasics.h
@@ -405,7 +405,8 @@ inline void jkqtpstatCumSum(InputIt first, InputIt last, OutputIt output) {
if (JKQTPIsOKFloat(v)) {
sum=sum+v;
}
- *++output=sum;
+ *output=sum;
+ ++output;
}
}
@@ -430,7 +431,8 @@ inline size_t jkqtpstatFilterGoodFloat(InputIt first, InputIt last, OutputIt out
for (auto it=first; it!=last; ++it) {
const double v=jkqtp_todouble(*it);
if (JKQTPIsOKFloat(v)) {
- *++output=v;
+ *output=v;
+ ++output;
NN++;
}
}
@@ -913,7 +915,8 @@ inline void jkqtpstat5NumberStatisticsAndOutliersOfSortedVector(const TVector& d
if (maximum) *maximum=qmax;
for (auto it=data.begin(); it!=data.end(); ++it) {
if (*itqmax) {
- *++outliersout=*it;
+ *outliersout=*it;
+ ++outliersout;
}
}
if (median) {
diff --git a/lib/jkqtcommon/jkqtpstathistogram.h b/lib/jkqtcommon/jkqtpstathistogram.h
index f693547533..a03a3507ef 100644
--- a/lib/jkqtcommon/jkqtpstathistogram.h
+++ b/lib/jkqtcommon/jkqtpstathistogram.h
@@ -108,10 +108,12 @@ inline void jkqtpstatHistogram1DAutoranged(InputIt first, InputIt last, OutputIt
}
double h=0;
for (size_t i=0; i > &ContourLines)
#ifdef JKQTBP_AUTOTIMER
JKQTPAutoOutputTimer jkaat(QString("JKQTPContourPlot::calcContourLines()"));
#else
- qDebug()<<"JKQTPContourPlot::calcContourLines()";
+ //qDebug()<<"JKQTPContourPlot::calcContourLines()";
#endif
double scale=1; ///< scale of the contour levels;
diff --git a/lib/jkqtplotter/graphs/jkqtpcontour.h b/lib/jkqtplotter/graphs/jkqtpcontour.h
index adac75ef06..6ea121d75d 100644
--- a/lib/jkqtplotter/graphs/jkqtpcontour.h
+++ b/lib/jkqtplotter/graphs/jkqtpcontour.h
@@ -217,7 +217,7 @@ class JKQTP_LIB_EXPORT JKQTPContourPlot: public JKQTPMathImage, public JKQTPGrap
* @param level contour plane
* @return above (1), on the plane (0), below (-1);
*/
- inline int compare2level(const QVector3D &vertex, double level) const ;
+ inline int compare2level(const QVector3D &vertex, float level) const ;
/** \brief calcContourLines calculates the contour lines using the CONREC algorithm */
void calcContourLines(QList > &ContourLines);
/** \brief For Caching: the contour lines as vector of single lines (one for each triangle). the list index refers to the contour level.
@@ -445,12 +445,14 @@ QPointF JKQTPContourPlot::interpolatePoint(const QVector3D &point1, const QVecto
}
////////////////////////////////////////////////////////////////////////////////////////////////
-int JKQTPContourPlot::compare2level(const QVector3D &vertex, double level) const {
- if (vertex.z() > level)
+int JKQTPContourPlot::compare2level(const QVector3D &vertex, float level) const {
+ if (vertex.z() > level) {
return 1;
+ }
- if (vertex.z() < level)
+ if (vertex.z() < level) {
return -1;
+ }
return 0;
}
diff --git a/lib/jkqtplotter/graphs/jkqtpsinglecolumnsymbols.cpp b/lib/jkqtplotter/graphs/jkqtpsinglecolumnsymbols.cpp
index 9b4dad40cd..a09d71e08a 100644
--- a/lib/jkqtplotter/graphs/jkqtpsinglecolumnsymbols.cpp
+++ b/lib/jkqtplotter/graphs/jkqtpsinglecolumnsymbols.cpp
@@ -41,6 +41,7 @@ JKQTPSingleColumnSymbolsGraph::JKQTPSingleColumnSymbolsGraph(JKQTBasePlotter *pa
parentPlotStyle=-1;
dataDirection=DataDirection::Y;
position=0;
+ width=1;
initSymbolStyle(parent, parentPlotStyle);
}
@@ -56,8 +57,11 @@ JKQTPSingleColumnSymbolsGraph::JKQTPSingleColumnSymbolsGraph(JKQTPlotter *parent
bool JKQTPSingleColumnSymbolsGraph::getXMinMax(double &minx, double &maxx, double &smallestGreaterZero)
{
+ //std::cout<<"JKQTPSingleColumnSymbolsGraph::getXMinMax(minx="<"<"<"<"<
inline JKQTPXFunctionLineGraph* jkqtpstatAddLinearRegression(JKQTBasePlotter* plotter, InputItX firstX, InputItX lastX, InputItY firstY, InputItY lastY, double* coeffA=nullptr, double* coeffB=nullptr, bool fixA=false, bool fixB=false) {
- double cA;
+ double cA=0;
if (coeffA) cA=*coeffA;
- double cB;
+ double cB=0;
if (coeffB) cB=*coeffB;
JKQTPASSERT_M(!fixA || (fixA && coeffA!=nullptr), "if fixA=true, coeffA needs to be provided");
@@ -1828,9 +1828,9 @@ JKQTP_LIB_EXPORT JKQTPXFunctionLineGraph* jkqtpstatAddLinearRegression(JKQTPXYGr
*/
template
inline JKQTPXFunctionLineGraph* jkqtpstatAddRobustIRLSLinearRegression(JKQTBasePlotter* plotter, InputItX firstX, InputItX lastX, InputItY firstY, InputItY lastY, double* coeffA=nullptr, double* coeffB=nullptr, bool fixA=false, bool fixB=false, double p=1.1, int iterations=100) {
- double cA;
+ double cA=0;
if (coeffA) cA=*coeffA;
- double cB;
+ double cB=0;
if (coeffB) cB=*coeffB;
JKQTPASSERT_M(!fixA || (fixA && coeffA!=nullptr), "if fixA=true, coeffA needs to be provided");
@@ -1916,9 +1916,9 @@ JKQTP_LIB_EXPORT JKQTPXFunctionLineGraph *jkqtpstatAddRobustIRLSLinearRegression
*/
template
inline JKQTPXFunctionLineGraph* jkqtpstatAddLinearWeightedRegression(JKQTBasePlotter* plotter, InputItX firstX, InputItX lastX, InputItY firstY, InputItY lastY, InputItW firstW, InputItW lastW, double* coeffA=nullptr, double* coeffB=nullptr, bool fixA=false, bool fixB=false, std::function fWeightDataToWi=&jkqtp_identity) {
- double cA;
+ double cA=0;
if (coeffA) cA=*coeffA;
- double cB;
+ double cB=0;
if (coeffB) cB=*coeffB;
JKQTPASSERT_M(!fixA || (fixA && coeffA!=nullptr), "if fixA=true, coeffA needs to be provided");
@@ -2002,9 +2002,9 @@ JKQTP_LIB_EXPORT JKQTPXFunctionLineGraph* jkqtpstatAddLinearWeightedRegression(J
*/
template
inline JKQTPXFunctionLineGraph* jkqtpstatAddRegression(JKQTBasePlotter* plotter, JKQTPStatRegressionModelType type, InputItX firstX, InputItX lastX, InputItY firstY, InputItY lastY, double* coeffA=nullptr, double* coeffB=nullptr, bool fixA=false, bool fixB=false) {
- double cA;
+ double cA=0;
if (coeffA) cA=*coeffA;
- double cB;
+ double cB=0;
if (coeffB) cB=*coeffB;
JKQTPASSERT_M(!fixA || (fixA && coeffA!=nullptr), "if fixA=true, coeffA needs to be provided");
@@ -2078,9 +2078,9 @@ JKQTP_LIB_EXPORT JKQTPXFunctionLineGraph* jkqtpstatAddRegression(JKQTPXYGraph *d
*/
template
inline JKQTPXFunctionLineGraph* jkqtpstatAddRobustIRLSRegression(JKQTBasePlotter* plotter, JKQTPStatRegressionModelType type, InputItX firstX, InputItX lastX, InputItY firstY, InputItY lastY, double* coeffA=nullptr, double* coeffB=nullptr, bool fixA=false, bool fixB=false, double p=1.1, int iterations=100) {
- double cA;
+ double cA=0;
if (coeffA) cA=*coeffA;
- double cB;
+ double cB=0;
if (coeffB) cB=*coeffB;
JKQTPASSERT_M(!fixA || (fixA && coeffA!=nullptr), "if fixA=true, coeffA needs to be provided");
@@ -2168,9 +2168,9 @@ JKQTP_LIB_EXPORT JKQTPXFunctionLineGraph *jkqtpstatAddRobustIRLSRegression(JKQTP
*/
template
inline JKQTPXFunctionLineGraph* jkqtpstatAddWeightedRegression(JKQTBasePlotter* plotter, JKQTPStatRegressionModelType type, InputItX firstX, InputItX lastX, InputItY firstY, InputItY lastY, InputItW firstW, InputItW lastW, double* coeffA=nullptr, double* coeffB=nullptr, bool fixA=false, bool fixB=false, std::function fWeightDataToWi=&jkqtp_identity) {
- double cA;
+ double cA=0;
if (coeffA) cA=*coeffA;
- double cB;
+ double cB=0;
if (coeffB) cB=*coeffB;
JKQTPASSERT_M(!fixA || (fixA && coeffA!=nullptr), "if fixA=true, coeffA needs to be provided");
diff --git a/lib/jkqtplotter/jkqtpbaseplotter.cpp b/lib/jkqtplotter/jkqtpbaseplotter.cpp
index b1bd1e09be..c8edb51dca 100644
--- a/lib/jkqtplotter/jkqtpbaseplotter.cpp
+++ b/lib/jkqtplotter/jkqtpbaseplotter.cpp
@@ -864,8 +864,8 @@ void JKQTBasePlotter::calcPlotScaling(JKQTPEnhancedPainter& painter){
// first we calculate the width and height of the plot from the widget dimensions and
// the supplied border sizes
- internalPlotWidth=widgetWidth/paintMagnification-internalPlotBorderLeft-internalPlotBorderRight;
- internalPlotHeight=widgetHeight/paintMagnification-internalPlotBorderTop-internalPlotBorderBottom;
+ internalPlotWidth=jkqtp_roundTo(static_cast(widgetWidth)/paintMagnification-internalPlotBorderLeft-internalPlotBorderRight);
+ internalPlotHeight=jkqtp_roundTo(static_cast(widgetHeight)/paintMagnification-internalPlotBorderTop-internalPlotBorderBottom);
////////////////////////////////////////////////////////////////////
@@ -877,7 +877,7 @@ void JKQTBasePlotter::calcPlotScaling(JKQTPEnhancedPainter& painter){
double newPlotHeight=internalPlotHeight;
double dx=0;
double dy=0;
- if (currRatio!=aspectRatio) {
+ if (jkqtp_approximatelyUnequal(currRatio,aspectRatio)) {
if (aspectRatio>=currRatio) {
newPlotWidth=aspectRatio*static_cast(internalPlotHeight);
} else {
@@ -907,8 +907,8 @@ void JKQTBasePlotter::calcPlotScaling(JKQTPEnhancedPainter& painter){
internalPlotBorderTop+=dy/2.0;
internalPlotBorderLeft+=dx/2.0;
internalPlotBorderRight+=dx/2.0;
- internalPlotWidth=widgetWidth/paintMagnification-internalPlotBorderLeft-internalPlotBorderRight;
- internalPlotHeight=widgetHeight/paintMagnification-internalPlotBorderTop-internalPlotBorderBottom;
+ internalPlotWidth=jkqtp_roundTo(static_cast(widgetWidth)/paintMagnification-internalPlotBorderLeft-internalPlotBorderRight);
+ internalPlotHeight=jkqtp_roundTo(static_cast(widgetHeight)/paintMagnification-internalPlotBorderTop-internalPlotBorderBottom);
}
@@ -926,7 +926,7 @@ void JKQTBasePlotter::calcPlotScaling(JKQTPEnhancedPainter& painter){
double newPlotHeight=cplotHeight;
double ymid=(yAxis->getMax()+yAxis->getMin())/2.0;
double currRatio=fabs(cplotWidth/cplotHeight);
- if (currRatio!=axisAspectRatio) {
+ if (jkqtp_approximatelyUnequal(currRatio,axisAspectRatio)) {
//if (axisAspectRatio<=currRatio) {
newPlotWidth=axisAspectRatio*cplotHeight;
//} else {
@@ -1027,7 +1027,8 @@ void JKQTBasePlotter::drawKey(JKQTPEnhancedPainter& painter) {
#endif
//qDebug()<<"start JKQTBasePlotter::plotKey";
- QFont kf(plotterStyle.defaultFontName, plotterStyle.keyStyle.fontSize*fontSizeMultiplier);
+ QFont kf(plotterStyle.defaultFontName, 10);
+ kf.setPointSizeF(plotterStyle.keyStyle.fontSize*fontSizeMultiplier);
QFontMetricsF kfm(kf);
// get the size of the key and if keyWidth>0 && keyHeight>0 draw the frame and the contents
@@ -1039,8 +1040,15 @@ void JKQTBasePlotter::drawKey(JKQTPEnhancedPainter& painter) {
if ((keyWidth>0) && (keyHeight>0)) {
// key position
- double x0,y0; // Position without plotterStyle.keyStyle.xOffset/plotterStyle.keyStyle.yOffset
- double x,y; // position of the key rectangle (=x0+plotterStyle.keyStyle.xOffset, y0+plotterStyle.keyStyle.yOffset)
+ //double x0,y0; // Position without plotterStyle.keyStyle.xOffset/plotterStyle.keyStyle.yOffset
+ //double x,y; // position of the key rectangle (=x0+plotterStyle.keyStyle.xOffset, y0+plotterStyle.keyStyle.yOffset)
+
+ // default: inside top-right
+ double x0=internalPlotBorderLeft+internalPlotWidth-keyRectangleWidth;
+ double x=x0-plotterStyle.keyStyle.xOffset*kfm.width('X');
+ double y0=internalPlotBorderTop;
+ double y=y0+plotterStyle.keyStyle.yOffset*kfm.width('X');
+
switch(plotterStyle.keyStyle.position) {
case JKQTPKeyOutsideTopRight:
x0=internalPlotBorderLeft+internalPlotWidth+internalPlotBorderRight-keyRectangleWidth;
@@ -1119,7 +1127,6 @@ void JKQTBasePlotter::drawKey(JKQTPEnhancedPainter& painter) {
y=y0+plotterStyle.keyStyle.yOffset*kfm.width('X');
break;
case JKQTPKeyInsideTopRight:
- default:
x0=internalPlotBorderLeft+internalPlotWidth-keyRectangleWidth;
x=x0-plotterStyle.keyStyle.xOffset*kfm.width('X');
y0=internalPlotBorderTop;
@@ -1154,7 +1161,7 @@ void JKQTBasePlotter::drawKey(JKQTPEnhancedPainter& painter) {
painter.setPen(pf);
if (useClipping) {
- QRegion cregion(x,y,keyRectangleWidth, keyRectangleHeight);
+ QRegion cregion(static_cast(x),static_cast(y),static_cast(keyRectangleWidth), static_cast(keyRectangleHeight));
painter.setClipping(true);
painter.setClipRegion(cregion);
painter.setClipping(true);
@@ -1176,7 +1183,7 @@ void JKQTBasePlotter::drawKey(JKQTPEnhancedPainter& painter) {
painter.drawRect(rectKey);
p.setStyle(Qt::SolidLine);
painter.setPen(p);
- painter.drawLine(x0,y0,rectKey.x(), rectKey.y());
+ painter.drawLine(QLineF(x0,y0,rectKey.x(), rectKey.y()));
}
@@ -1245,7 +1252,7 @@ void JKQTBasePlotter::drawPlot(JKQTPEnhancedPainter& painter, bool showOverlays)
p.setWidthF(plotterStyle.debugRegionLineWidth);
painter.setBrush(QBrush(QColor(Qt::transparent)));
painter.setPen(p);
- painter.drawRect(internalPlotBorderLeft, plotterStyle.plotBorderTop, internalPlotWidth, s.height());
+ painter.drawRect(QRectF(internalPlotBorderLeft, plotterStyle.plotBorderTop, internalPlotWidth, s.height()));
}
}
@@ -1276,13 +1283,13 @@ void JKQTBasePlotter::drawPlot(JKQTPEnhancedPainter& painter, bool showOverlays)
p.setStyle(Qt::DashLine);
painter.setPen(p);
painter.setBrush(QBrush(QColor(Qt::transparent)));
- painter.drawRect(internalPlotBorderLeft, internalPlotBorderTop, internalPlotWidth, internalPlotHeight);
+ painter.drawRect(QRectF(internalPlotBorderLeft, internalPlotBorderTop, internalPlotWidth, internalPlotHeight));
p.setColor(QColor("maroon"));
col=p.color(); col.setAlphaF(0.8); p.setColor(col);
p.setWidthF(plotterStyle.debugRegionLineWidth);
p.setStyle(Qt::DotLine);
painter.setPen(p);
- painter.drawRect(internalPlotBorderLeft_notIncludingOutsidePlotSections, internalPlotBorderTop_notIncludingOutsidePlotSections, widgetWidth-internalPlotBorderLeft_notIncludingOutsidePlotSections-internalPlotBorderRight_notIncludingOutsidePlotSections, widgetHeight-internalPlotBorderTop_notIncludingOutsidePlotSections-internalPlotBorderBottom_notIncludingOutsidePlotSections);
+ painter.drawRect(QRectF(internalPlotBorderLeft_notIncludingOutsidePlotSections, internalPlotBorderTop_notIncludingOutsidePlotSections, widgetWidth-internalPlotBorderLeft_notIncludingOutsidePlotSections-internalPlotBorderRight_notIncludingOutsidePlotSections, widgetHeight-internalPlotBorderTop_notIncludingOutsidePlotSections-internalPlotBorderBottom_notIncludingOutsidePlotSections));
p.setColor(QColor("yellow"));
col=p.color(); col.setAlphaF(0.8); p.setColor(col);
p.setWidthF(plotterStyle.debugRegionLineWidth);
@@ -1305,7 +1312,7 @@ void JKQTBasePlotter::drawOverlaysWithHints(JKQTPEnhancedPainter &painter) {
#endif
if (overlays.isEmpty()) return;
if (useClipping) {
- QRegion cregion(internalPlotBorderLeft, internalPlotBorderTop, internalPlotWidth, internalPlotHeight);
+ QRegion cregion(static_cast(internalPlotBorderLeft), static_cast(internalPlotBorderTop), static_cast(internalPlotWidth), static_cast(internalPlotHeight));
painter.setClipping(true);
painter.setClipRegion(cregion);
}
@@ -1325,9 +1332,9 @@ void JKQTBasePlotter::gridPrintingCalc() {
gridPrintingRows.clear();
gridPrintingColumns.clear();
if (!gridPrinting) {
- gridPrintingSize=QSize(widgetWidth/paintMagnification, widgetHeight/paintMagnification);
- gridPrintingRows.push_back(widgetHeight/paintMagnification);
- gridPrintingColumns.push_back(widgetWidth/paintMagnification);
+ gridPrintingSize=QSize(static_cast(widgetWidth/paintMagnification), static_cast(widgetHeight/paintMagnification));
+ gridPrintingRows.push_back(static_cast(widgetHeight/paintMagnification));
+ gridPrintingColumns.push_back(static_cast(widgetWidth/paintMagnification));
} else {
// first find min and max columns/rows
size_t cmin=gridPrintingCurrentX;
@@ -1345,15 +1352,15 @@ void JKQTBasePlotter::gridPrintingCalc() {
// fill gridPrintingRows and gridPrintingColumns
for (size_t i=0; i<=cmax; i++) { gridPrintingColumns.push_back(0); }
for (size_t i=0; i<=rmax; i++) { gridPrintingRows.push_back(0); }
- gridPrintingColumns[gridPrintingCurrentX]=widgetWidth/paintMagnification;
- gridPrintingRows[gridPrintingCurrentY]=widgetHeight/paintMagnification;
+ gridPrintingColumns[static_cast(gridPrintingCurrentX)]=static_cast(widgetWidth/paintMagnification);
+ gridPrintingRows[static_cast(gridPrintingCurrentY)]=static_cast(widgetHeight/paintMagnification);
for (int i=0; i< gridPrintingList.size(); i++) {
- int cw=gridPrintingList[i].plotter->widgetWidth/paintMagnification;
- int ch=gridPrintingList[i].plotter->widgetHeight/paintMagnification;
+ size_t cw=static_cast(gridPrintingList[i].plotter->widgetWidth/paintMagnification);
+ size_t ch=static_cast(gridPrintingList[i].plotter->widgetHeight/paintMagnification);
size_t c=gridPrintingList[i].x;
size_t r=gridPrintingList[i].y;
- if (cw>gridPrintingColumns[c]) gridPrintingColumns[c]=cw;
- if (ch>gridPrintingRows[r]) gridPrintingRows[r]=ch;
+ if (cw>gridPrintingColumns[static_cast(c)]) gridPrintingColumns[static_cast(c)]=cw;
+ if (ch>gridPrintingRows[static_cast(r)]) gridPrintingRows[static_cast(r)]=ch;
}
int w=0;
int h=0;
@@ -1419,8 +1426,8 @@ void JKQTBasePlotter::gridPaint(JKQTPEnhancedPainter& painter, QSizeF pageRect,
int t_x=0;
int t_y=0;
//std::cout<<"printing this ...\n";
- for (size_t i=0; i(i)]; }
+ for (size_t i=0; i(i)]; }
//std::cout<<"printing this @ "<(j)]; }
+ for (size_t j=0; j(j)]; }
//std::cout<<"printing "<drawPlot(painter, showOverlays);
@@ -1483,11 +1490,11 @@ void JKQTBasePlotter::gridPaintOverlays(JKQTPEnhancedPainter &painter, QSizeF pa
{
// plot this plotter
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
- int t_x=0;
- int t_y=0;
+ size_t t_x=0;
+ size_t t_y=0;
//std::cout<<"printing this ...\n";
- for (size_t i=0; i(i)]; }
+ for (size_t i=0; i(i)]; }
//std::cout<<"printing this @ "<(j)]; }
+ for (size_t j=0; j(j)]; }
//std::cout<<"printing "<drawOverlaysWithHints(painter);
@@ -1953,11 +1960,11 @@ double JKQTBasePlotter::getPaintMagnification() const
void JKQTBasePlotter::updatePreviewLabel() {
double factor=1;
if (exportUnitInMM) factor=600.0/double(printSizeX_Millimeter);
- QImage pix(double(printSizeX_Millimeter)*factor*1.1, double(printSizeY_Millimeter)*factor*1.1, QImage::Format_ARGB32);
+ QImage pix(jkqtp_roundTo(double(printSizeX_Millimeter)*factor*1.1), jkqtp_roundTo(double(printSizeY_Millimeter)*factor*1.1), QImage::Format_ARGB32);
pix.fill(Qt::transparent);
JKQTPEnhancedPainter painter;
painter.begin(&pix);
- exportpreviewPaintRequested(painter, QSize(double(printSizeX_Millimeter)*factor, double(printSizeY_Millimeter)*factor));
+ exportpreviewPaintRequested(painter, QSize(jkqtp_roundTo(double(printSizeX_Millimeter)*factor), jkqtp_roundTo(double(printSizeY_Millimeter)*factor)));
painter.end();
if (exportPreviewLabel) {
QPixmap pm;
@@ -1992,7 +1999,7 @@ void JKQTBasePlotter::printpreviewPaintRequested(QPrinter* printer) {
//printer->setPaperSize(QPrinter::Custom);
printer->setOrientation(QPrinter::Portrait);
printer->setPaperSize(QSizeF(printSizeX_Millimeter, printSizeY_Millimeter), QPrinter::Millimeter);
- if (!gridPrinting) widgetHeight=widgetWidth*printSizeY_Millimeter/printSizeX_Millimeter;
+ if (!gridPrinting) widgetHeight=jkqtp_roundTo(widgetWidth*printSizeY_Millimeter/printSizeX_Millimeter);
}
@@ -2080,13 +2087,13 @@ void JKQTBasePlotter::printpreviewPaintRequestedNew(QPaintDevice *paintDevice)
printer->setPaperSize(QSizeF(printSizeX_Millimeter, printSizeY_Millimeter), QPrinter::Millimeter);
} else if (svg) {
QRectF siz=QRectF(0,0,printSizeX_Millimeter,printSizeY_Millimeter);
- svg->setSize(QSize(ceil(siz.width()*svg->resolution()/25.4), ceil(siz.height()*svg->resolution()/25.4)));
+ svg->setSize(QSizeF(ceil(siz.width()*svg->resolution()/25.4), ceil(siz.height()*svg->resolution()/25.4)).toSize());
svg->setViewBox(QRect(0,0,-1,-1));//*25.4/double(svg->resolution()), printSizeY_Millimeter*25.4/double(svg->resolution())));
}
}
paintMagnification=gridPrintingSize.width()/(printSizeX_Millimeter/25.4*double(paintDevice->logicalDpiX()));
- if (!gridPrinting) widgetHeight=widgetWidth*printSizeY_Millimeter/printSizeX_Millimeter;
+ if (!gridPrinting) widgetHeight=jkqtp_roundTo(widgetWidth*printSizeY_Millimeter/printSizeX_Millimeter);
JKQTPEnhancedPainter painter;
if (printer) painter.begin(printer);
@@ -2330,7 +2337,7 @@ void JKQTBasePlotter::draw(JKQTPEnhancedPainter& painter, const QPoint& pos, boo
QElapsedTimer timeAll;
timeAll.start();
#endif
- QRect rect=QRect(pos, QSize(widgetWidth/paintMagnification, widgetHeight/paintMagnification));
+ QRectF rect(pos, QSizeF(widgetWidth/paintMagnification, widgetHeight/paintMagnification));
{
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
painter.translate(rect.topLeft());
@@ -2407,7 +2414,7 @@ void JKQTBasePlotter::drawNonGrid(JKQTPEnhancedPainter& painter, const QPoint& p
QElapsedTimer timeAll;
timeAll.start();
#endif
- QRect rect=QRect(pos, QSize(widgetWidth/paintMagnification, widgetHeight/paintMagnification));
+ QRectF rect(pos, QSizeF(widgetWidth/paintMagnification, widgetHeight/paintMagnification));
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
painter.translate(rect.topLeft());
#ifdef JKQTBP_DEBUGTIMING
@@ -2446,7 +2453,7 @@ void JKQTBasePlotter::drawNonGridOverlays(JKQTPEnhancedPainter& painter, const Q
#ifdef JKQTBP_AUTOTIMER
JKQTPAutoOutputTimer jkaaot(QString("JKQTBasePlotter::drawNonGridOverlays(point)"));
#endif
- QRect rect=QRect(pos, QSize(widgetWidth/paintMagnification, widgetHeight/paintMagnification));
+ QRectF rect(pos, QSizeF(widgetWidth/paintMagnification, widgetHeight/paintMagnification));
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
painter.translate(rect.topLeft());
double scale=static_cast(rect.width())/static_cast(widgetWidth)*paintMagnification;
@@ -2485,7 +2492,7 @@ bool JKQTBasePlotter::doesMaintainAspectRatio() const { return this->maintainAsp
void JKQTBasePlotter::setAspectRatio(double __value)
{
- if (this->aspectRatio != __value) {
+ if (jkqtp_approximatelyUnequal(this->aspectRatio , __value)) {
this->aspectRatio = __value;
redrawPlot();
}
@@ -2521,7 +2528,7 @@ bool JKQTBasePlotter::isUsingAntiAliasingForText() const
void JKQTBasePlotter::setGraphWidth(double __value)
{
- if (this->plotterStyle.defaultGraphWidth != __value) {
+ if (jkqtp_approximatelyUnequal(this->plotterStyle.defaultGraphWidth , __value)) {
this->plotterStyle.defaultGraphWidth = __value;
redrawPlot();
}
@@ -2582,7 +2589,7 @@ QBrush JKQTBasePlotter::getPlotBackgroundBrush() const
void JKQTBasePlotter::setKeyFontSize(double __value)
{
- if (this->plotterStyle.keyStyle.fontSize != __value) {
+ if (jkqtp_approximatelyUnequal(this->plotterStyle.keyStyle.fontSize , __value)) {
this->plotterStyle.keyStyle.fontSize = __value;
redrawPlot();
}
@@ -2609,7 +2616,7 @@ QColor JKQTBasePlotter::getKeyTextColor() const
void JKQTBasePlotter::setKeyItemWidth(double __value)
{
- if (this->plotterStyle.keyStyle.itemWidth != __value) {
+ if (jkqtp_approximatelyUnequal(this->plotterStyle.keyStyle.itemWidth , __value)) {
this->plotterStyle.keyStyle.itemWidth = __value;
redrawPlot();
}
@@ -2622,7 +2629,7 @@ double JKQTBasePlotter::getKeyItemWidth() const
void JKQTBasePlotter::setKeyItemHeight(double __value)
{
- if (this->plotterStyle.keyStyle.itemHeight != __value) {
+ if (jkqtp_approximatelyUnequal(this->plotterStyle.keyStyle.itemHeight , __value)) {
this->plotterStyle.keyStyle.itemHeight = __value;
redrawPlot();
}
@@ -2635,7 +2642,7 @@ double JKQTBasePlotter::getKeyItemHeight() const
void JKQTBasePlotter::setKeyYSeparation(double __value)
{
- if (this->plotterStyle.keyStyle.ySeparation != __value) {
+ if (jkqtp_approximatelyUnequal(this->plotterStyle.keyStyle.ySeparation , __value)) {
this->plotterStyle.keyStyle.ySeparation = __value;
redrawPlot();
}
@@ -2648,7 +2655,7 @@ double JKQTBasePlotter::getKeyYSeparation() const
void JKQTBasePlotter::setKeyLineLength(double __value)
{
- if (this->plotterStyle.keyStyle.sampleLineLength != __value) {
+ if (jkqtp_approximatelyUnequal(this->plotterStyle.keyStyle.sampleLineLength , __value)) {
this->plotterStyle.keyStyle.sampleLineLength = __value;
redrawPlot();
}
@@ -2661,7 +2668,7 @@ double JKQTBasePlotter::getKeyLineLength() const
void JKQTBasePlotter::setKeyXMargin(double __value)
{
- if (this->plotterStyle.keyStyle.xMargin != __value) {
+ if (jkqtp_approximatelyUnequal(this->plotterStyle.keyStyle.xMargin , __value)) {
this->plotterStyle.keyStyle.xMargin = __value;
redrawPlot();
}
@@ -2674,7 +2681,7 @@ double JKQTBasePlotter::getKeyXMargin() const
void JKQTBasePlotter::setKeyYMargin(double __value)
{
- if (this->plotterStyle.keyStyle.yMargin != __value) {
+ if (jkqtp_approximatelyUnequal(this->plotterStyle.keyStyle.yMargin , __value)) {
this->plotterStyle.keyStyle.yMargin = __value;
redrawPlot();
}
@@ -2687,7 +2694,7 @@ double JKQTBasePlotter::getKeyYMargin() const
void JKQTBasePlotter::setKeyXSeparation(double __value)
{
- if (this->plotterStyle.keyStyle.xSeparation != __value) {
+ if (jkqtp_approximatelyUnequal(this->plotterStyle.keyStyle.xSeparation , __value)) {
this->plotterStyle.keyStyle.xSeparation = __value;
redrawPlot();
}
@@ -2700,7 +2707,7 @@ double JKQTBasePlotter::getKeyXSeparation() const
void JKQTBasePlotter::setKeyXOffset(double __value)
{
- if (this->plotterStyle.keyStyle.xOffset != __value) {
+ if (jkqtp_approximatelyUnequal(this->plotterStyle.keyStyle.xOffset , __value)) {
this->plotterStyle.keyStyle.xOffset = __value;
redrawPlot();
}
@@ -2713,7 +2720,7 @@ double JKQTBasePlotter::getKeyXOffset() const
void JKQTBasePlotter::setKeyYOffset(double __value)
{
- if (this->plotterStyle.keyStyle.yOffset != __value) {
+ if (jkqtp_approximatelyUnequal(this->plotterStyle.keyStyle.yOffset , __value)) {
this->plotterStyle.keyStyle.yOffset = __value;
redrawPlot();
}
@@ -2806,7 +2813,7 @@ void JKQTBasePlotter::setKeyBackgroundTexture(const QPixmap &__value)
void JKQTBasePlotter::setKeyFrameWidth(double __value)
{
- if (this->plotterStyle.keyStyle.frameWidth != __value) {
+ if (jkqtp_approximatelyUnequal(this->plotterStyle.keyStyle.frameWidth , __value)) {
this->plotterStyle.keyStyle.frameWidth = __value;
redrawPlot();
}
@@ -2814,7 +2821,7 @@ void JKQTBasePlotter::setKeyFrameWidth(double __value)
void JKQTBasePlotter::setKeyFrameRounding(double __value)
{
- if (this->plotterStyle.keyStyle.frameRounding != __value) {
+ if (jkqtp_approximatelyUnequal(this->plotterStyle.keyStyle.frameRounding , __value)) {
this->plotterStyle.keyStyle.frameRounding = __value;
redrawPlot();
}
@@ -2892,9 +2899,9 @@ void JKQTBasePlotter::setDefaultTextColor(QColor __value)
}
}
-void JKQTBasePlotter::setDefaultTextSize(float __value)
+void JKQTBasePlotter::setDefaultTextSize(double __value)
{
- if (this->plotterStyle.defaultFontSize != __value) {
+ if (jkqtp_approximatelyUnequal(this->plotterStyle.defaultFontSize , __value)) {
this->plotterStyle.defaultFontSize = __value;
redrawPlot();
}
@@ -2910,7 +2917,7 @@ void JKQTBasePlotter::setDefaultTextFontName(const QString &__value)
void JKQTBasePlotter::setPlotLabelFontSize(double __value)
{
- if (this->plotterStyle.plotLabelFontSize != __value) {
+ if (jkqtp_approximatelyUnequal(this->plotterStyle.plotLabelFontSize , __value)) {
this->plotterStyle.plotLabelFontSize = __value;
redrawPlot();
}
@@ -3084,7 +3091,7 @@ double JKQTBasePlotter::getPlotFrameRounding() const
void JKQTBasePlotter::setPlotFrameWidth(double __value)
{
- if (this->plotterStyle.plotFrameWidth != __value) {
+ if (jkqtp_approximatelyUnequal(this->plotterStyle.plotFrameWidth , __value)) {
this->plotterStyle.plotFrameWidth = __value;
redrawPlot();
}
@@ -3092,7 +3099,7 @@ void JKQTBasePlotter::setPlotFrameWidth(double __value)
void JKQTBasePlotter::setPlotFrameRounding(double __value)
{
- if (this->plotterStyle.plotFrameRounding != __value) {
+ if (jkqtp_approximatelyUnequal(this->plotterStyle.plotFrameRounding , __value)) {
this->plotterStyle.plotFrameRounding = __value;
redrawPlot();
}
@@ -3140,7 +3147,7 @@ void JKQTBasePlotter::setUseAntiAliasingForSystem(bool __value)
void JKQTBasePlotter::setAxisAspectRatio(double __value)
{
- if (this->axisAspectRatio != __value) {
+ if (jkqtp_approximatelyUnequal(this->axisAspectRatio , __value)) {
this->axisAspectRatio = __value;
redrawPlot();
}
@@ -3254,39 +3261,71 @@ const JKQTPVerticalAxis *JKQTBasePlotter::getYAxis() const {
return yAxis;
}
-QAction *JKQTBasePlotter::getActionSavePlot() const { return this->actSavePlot; }
+QAction *JKQTBasePlotter::getActionSavePlot() const {
+ return this->actSavePlot;
+}
-QAction *JKQTBasePlotter::getActionSaveData() const { return this->actSaveData; }
+QAction *JKQTBasePlotter::getActionSaveData() const {
+ return this->actSaveData;
+}
-QAction *JKQTBasePlotter::getActionCopyData() const { return this->actCopyData; }
+QAction *JKQTBasePlotter::getActionCopyData() const {
+ return this->actCopyData;
+}
-QAction *JKQTBasePlotter::getActionCopyPixelImage() const { return this->actCopyPixelImage; }
+QAction *JKQTBasePlotter::getActionCopyPixelImage() const {
+ return this->actCopyPixelImage;
+}
-QAction *JKQTBasePlotter::getActionCopyMatlab() const { return this->actCopyMatlab; }
+QAction *JKQTBasePlotter::getActionCopyMatlab() const {
+ return this->actCopyMatlab;
+}
-QAction *JKQTBasePlotter::getActionSavePDF() const { return this->actSavePDF; }
+QAction *JKQTBasePlotter::getActionSavePDF() const {
+ return this->actSavePDF;
+}
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
-QAction *JKQTBasePlotter::getActionSavePS() const { return this->actSavePS; }
+QAction *JKQTBasePlotter::getActionSavePS() const {
+ return this->actSavePS;
+}
#endif
-QAction *JKQTBasePlotter::getActionSavePix() const { return this->actSavePix; }
+QAction *JKQTBasePlotter::getActionSavePix() const {
+ return this->actSavePix;
+}
-QAction *JKQTBasePlotter::getActionSaveSVG() const { return this->actSaveSVG; }
+QAction *JKQTBasePlotter::getActionSaveSVG() const {
+ return this->actSaveSVG;
+}
-QAction *JKQTBasePlotter::getActionPrint() const { return this->actPrint; }
+QAction *JKQTBasePlotter::getActionPrint() const {
+ return this->actPrint;
+}
-QAction *JKQTBasePlotter::getActionSaveCSV() const { return this->actSaveCSV; }
+QAction *JKQTBasePlotter::getActionSaveCSV() const {
+ return this->actSaveCSV;
+}
-QAction *JKQTBasePlotter::getActionZoomAll() const { return this->actZoomAll; }
+QAction *JKQTBasePlotter::getActionZoomAll() const {
+ return this->actZoomAll;
+}
-QAction *JKQTBasePlotter::getActionZoomIn() const { return this->actZoomIn; }
+QAction *JKQTBasePlotter::getActionZoomIn() const {
+ return this->actZoomIn;
+}
-QAction *JKQTBasePlotter::getActionZoomOut() const { return this->actZoomOut; }
+QAction *JKQTBasePlotter::getActionZoomOut() const {
+ return this->actZoomOut;
+}
-QAction *JKQTBasePlotter::getActionShowPlotData() const { return this->actShowPlotData; }
+QAction *JKQTBasePlotter::getActionShowPlotData() const {
+ return this->actShowPlotData;
+}
-JKQTBasePlotter::AdditionalActionsMap JKQTBasePlotter::getLstAdditionalPlotterActions() const { return this->lstAdditionalPlotterActions; }
+JKQTBasePlotter::AdditionalActionsMap JKQTBasePlotter::getLstAdditionalPlotterActions() const {
+ return this->lstAdditionalPlotterActions;
+}
QString JKQTBasePlotter::getCSVdecimalSeparator() const
{
@@ -3325,9 +3364,13 @@ void JKQTBasePlotter::deregisterAdditionalAction(QAction *act)
}
}
-bool JKQTBasePlotter::getMasterSynchronizeWidth() const { return this->masterSynchronizeWidth; }
+bool JKQTBasePlotter::getMasterSynchronizeWidth() const {
+ return this->masterSynchronizeWidth;
+}
-bool JKQTBasePlotter::getMasterSynchronizeHeight() const { return this->masterSynchronizeHeight; }
+bool JKQTBasePlotter::getMasterSynchronizeHeight() const {
+ return this->masterSynchronizeHeight;
+}
void JKQTBasePlotter::setFontSizePrintMultiplier(double __value)
@@ -3350,9 +3393,13 @@ double JKQTBasePlotter::getLineWidthPrintMultiplier() const
return this->lineWidthPrintMultiplier;
}
-double JKQTBasePlotter::getFontSizeMultiplier() const { return this->fontSizeMultiplier; }
+double JKQTBasePlotter::getFontSizeMultiplier() const {
+ return this->fontSizeMultiplier;
+}
-double JKQTBasePlotter::getLineWidthMultiplier() const { return this->lineWidthMultiplier; }
+double JKQTBasePlotter::getLineWidthMultiplier() const {
+ return this->lineWidthMultiplier;
+}
void JKQTBasePlotter::copyData() {
loadUserSettings();
@@ -3767,7 +3814,7 @@ void JKQTBasePlotter::saveImage(const QString& filename, bool displayPreview) {
mathText.setUseUnparsed(!jkqtpPaintDeviceAdapters[adapterID]->useLatexParser());
gridPrintingCalc();
- QPaintDevice* svg=jkqtpPaintDeviceAdapters[adapterID]->createPaintdevice(fn, gridPrintingSize.width(), gridPrintingSize.height());
+ QPaintDevice* svg=jkqtpPaintDeviceAdapters[adapterID]->createPaintdevice(fn, jkqtp_roundTo(gridPrintingSize.width()), jkqtp_roundTo(gridPrintingSize.height()));
if (!printpreviewNew(svg, jkqtpPaintDeviceAdapters[adapterID]->getSetAbsolutePaperSize(), jkqtpPaintDeviceAdapters[adapterID]->getPrintSizeXInMM(), jkqtpPaintDeviceAdapters[adapterID]->getPrintSizeYInMM(), displayPreview)) {
delete svg;
@@ -3852,7 +3899,7 @@ void JKQTBasePlotter::saveAsPixelImage(const QString& filename, bool displayPrev
if (!displayPreview || exportpreview(gridPrintingSize, false)) {
- QImage png(QSize(double(printSizeX_Millimeter)*1.1, double(printSizeY_Millimeter)*1.1), QImage::Format_ARGB32);
+ QImage png(QSizeF(double(printSizeX_Millimeter)*1.1, double(printSizeY_Millimeter)*1.1).toSize(), QImage::Format_ARGB32);
png.fill(Qt::transparent);
JKQTPEnhancedPainter painter;
painter.begin(&png);
@@ -3865,7 +3912,7 @@ void JKQTBasePlotter::saveAsPixelImage(const QString& filename, bool displayPrev
/*calcPlotScaling(painter);
gridPaint(painter, png.rect().size());*/\
//qDebug()<(printSizeX_Millimeter), jkqtp_roundTo(printSizeY_Millimeter)));
painter.end();
if (form=="NONE") png.save(fn);
else png.save(fn, form.toLatin1().data());
@@ -3907,7 +3954,7 @@ void JKQTBasePlotter::copyPixelImage() {
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
//if (exportpreview(gridPrintingSize, false)) {
- QImage png(QSize(double(printSizeX_Millimeter), double(printSizeY_Millimeter)), QImage::Format_ARGB32);
+ QImage png(QSizeF(double(printSizeX_Millimeter), double(printSizeY_Millimeter)).toSize(), QImage::Format_ARGB32);
{
png.fill(Qt::transparent);
JKQTPEnhancedPainter painter;
@@ -3920,7 +3967,7 @@ void JKQTBasePlotter::copyPixelImage() {
/*calcPlotScaling(painter);
gridPaint(painter, png.rect().size());*/
- exportpreviewPaintRequested(painter, QSize(printSizeX_Millimeter, printSizeY_Millimeter));
+ exportpreviewPaintRequested(painter, QSizeF(printSizeX_Millimeter, printSizeY_Millimeter).toSize());
painter.end();
}
QByteArray svgdata;
@@ -3930,7 +3977,7 @@ void JKQTBasePlotter::copyPixelImage() {
QSvgGenerator* svg=new QSvgGenerator;
svg->setResolution(96);
//svg->setResolution(300);
- QSize size=QSize(printSizeX_Millimeter, printSizeX_Millimeter);
+ QSize size=QSizeF(printSizeX_Millimeter, printSizeX_Millimeter).toSize();
double factor=double(size.width())/double(widgetWidth)*paintMagnification;
// TODO: CORRECT THIS
//qDebug()<setResolution(96);
- QSize size=QSize(gridPrintingSize.width()*25.4/svg->resolution(), gridPrintingSize.height()*25.4/svg->resolution());
+ QSize size=QSizeF(gridPrintingSize.width()*25.4/svg->resolution(), gridPrintingSize.height()*25.4/svg->resolution()).toSize();
svg->setSize(size);
svg->setFileName(fn);
@@ -4145,291 +4192,6 @@ void JKQTBasePlotter::synchronizeXYAxis(double newxmin, double newxmax, double n
emitSignals=oldemitSignals;
}
-size_t JKQTBasePlotter::addGraph(size_t xColumn, size_t yColumn, const QString& title, JKQTPGraphPlotstyle graphStyle) {
- if (graphStyle==JKQTPImpulsesHorizontal) {
- JKQTPImpulsesHorizontalGraph* gr=new JKQTPImpulsesHorizontalGraph(this);
- gr->setTitle(title);
- gr->setXColumn(xColumn);
- gr->setYColumn(yColumn);
- return addGraph(gr);
- } else if (graphStyle==JKQTPImpulsesVertical) {
- JKQTPImpulsesVerticalGraph* gr=new JKQTPImpulsesVerticalGraph(this);
- gr->setTitle(title);
- gr->setXColumn(xColumn);
- gr->setYColumn(yColumn);
- return addGraph(gr);
- } else if (graphStyle==JKQTPFilledCurveX) {
- JKQTPFilledCurveXGraph* gr=new JKQTPFilledCurveXGraph(this);
- gr->setTitle(title);
- gr->setXColumn(xColumn);
- gr->setYColumn(yColumn);
- return addGraph(gr);
- } else if (graphStyle==JKQTPFilledCurveY) {
- JKQTPFilledCurveYGraph* gr=new JKQTPFilledCurveYGraph(this);
- gr->setTitle(title);
- gr->setXColumn(xColumn);
- gr->setYColumn(yColumn);
- return addGraph(gr);
- } else if (graphStyle==JKQTPStepsX) {
- JKQTPSpecialLineHorizontalGraph* gr=new JKQTPSpecialLineHorizontalGraph(this);
- gr->setTitle(title);
- gr->setXColumn(xColumn);
- gr->setYColumn(yColumn);
- return addGraph(gr);
- } else if (graphStyle==JKQTPStepsY) {
- JKQTPSpecialLineVerticalGraph* gr=new JKQTPSpecialLineVerticalGraph(this);
- gr->setTitle(title);
- gr->setXColumn(xColumn);
- gr->setYColumn(yColumn);
- return addGraph(gr);
- } else {
- JKQTPXYLineGraph* gr=new JKQTPXYLineGraph(this);
- gr->setTitle(title);
- gr->setXColumn(xColumn);
- gr->setYColumn(yColumn);
- if (graphStyle==JKQTPPoints) { gr->setSymbolType(JKQTPPlus); gr->setDrawLine(false); }
- else if (graphStyle==JKQTPLinesPoints) gr->setSymbolType(JKQTPPlus);
- return addGraph(gr);
- }
- return -1;
-}
-
-size_t JKQTBasePlotter::addGraph(size_t xColumn, size_t yColumn, const QString& title, JKQTPGraphPlotstyle graphStyle, QColor color, JKQTPGraphSymbols symbol, Qt::PenStyle penstyle, double width) {
- if (graphStyle==JKQTPImpulsesHorizontal) {
- JKQTPImpulsesHorizontalGraph* gr=new JKQTPImpulsesHorizontalGraph(this);
- gr->setTitle(title);
- gr->setXColumn(xColumn);
- gr->setYColumn(yColumn);
- gr->setColor(color);
- gr->setLineWidth(width);
- return addGraph(gr);
- } else if (graphStyle==JKQTPImpulsesVertical) {
- JKQTPImpulsesVerticalGraph* gr=new JKQTPImpulsesVerticalGraph(this);
- gr->setTitle(title);
- gr->setXColumn(xColumn);
- gr->setYColumn(yColumn);
- gr->setColor(color);
- gr->setLineWidth(width);
- return addGraph(gr);
- } else if (graphStyle==JKQTPFilledCurveX) {
- JKQTPFilledCurveXGraph* gr=new JKQTPFilledCurveXGraph(this);
- gr->setTitle(title);
- gr->setXColumn(xColumn);
- gr->setYColumn(yColumn);
- gr->setLineWidth(width);
- gr->setLineStyle(penstyle);
- gr->setFillColor(color);
- return addGraph(gr);
- } else if (graphStyle==JKQTPFilledCurveY) {
- JKQTPFilledCurveYGraph* gr=new JKQTPFilledCurveYGraph(this);
- gr->setTitle(title);
- gr->setXColumn(xColumn);
- gr->setYColumn(yColumn);
- gr->setLineWidth(width);
- gr->setLineStyle(penstyle);
- gr->setFillColor(color);
- return addGraph(gr);
- } else if (graphStyle==JKQTPStepsX) {
- JKQTPSpecialLineHorizontalGraph* gr=new JKQTPSpecialLineHorizontalGraph(this);
- gr->setTitle(title);
- gr->setXColumn(xColumn);
- gr->setYColumn(yColumn);
- gr->setLineWidth(width);
- gr->setLineStyle(penstyle);
- gr->setFillColor(color);
- return addGraph(gr);
- } else if (graphStyle==JKQTPStepsY) {
- JKQTPSpecialLineVerticalGraph* gr=new JKQTPSpecialLineVerticalGraph(this);
- gr->setTitle(title);
- gr->setXColumn(xColumn);
- gr->setYColumn(yColumn);
- gr->setLineWidth(width);
- gr->setYColumn(penstyle);
- gr->setFillColor(color);
- return addGraph(gr);
- } else {
- JKQTPXYLineGraph* gr=new JKQTPXYLineGraph(this);
- gr->setTitle(title);
- gr->setXColumn(xColumn);
- gr->setYColumn(yColumn);
- gr->setLineWidth(width);
- gr->setLineStyle(penstyle);
- gr->setLineColor(color);
- gr->setSymbolColor(color);
- gr->setSymbolType(symbol);
- if (graphStyle==JKQTPPoints) { gr->setSymbolType(JKQTPPlus); gr->setDrawLine(false); }
- else if (graphStyle==JKQTPLinesPoints) gr->setSymbolType(JKQTPPlus);
- return addGraph(gr);
- }
- return -1;
-}
-
-size_t JKQTBasePlotter::addHorizontalBoxplot(QString title, int posColumn, int medianColumn, int minColumn, int maxColumn, int percentile25Column, int percentile75Column, int meanColumn) {
- JKQTPBoxplotHorizontalGraph* box=new JKQTPBoxplotHorizontalGraph(this);
- box->setPositionColumn(posColumn);
- box->setMedianColumn(medianColumn);
- box->setMeanColumn(meanColumn);
- box->setMinColumn(minColumn);
- box->setMaxColumn(maxColumn);
- box->setPercentile25Column(percentile25Column);
- box->setPercentile75Column(percentile75Column);
- box->setTitle(title);
- return addGraph(box);
-}
-
-size_t JKQTBasePlotter::addVerticalBoxplot(QString title, int posColumn, int medianColumn, int minColumn, int maxColumn, int percentile25Column, int percentile75Column, int meanColumn) {
- JKQTPBoxplotVerticalGraph* box=new JKQTPBoxplotVerticalGraph(this);
- box->setPositionColumn(posColumn);
- box->setMedianColumn(medianColumn);
- box->setMeanColumn(meanColumn);
- box->setMinColumn(minColumn);
- box->setMaxColumn(maxColumn);
- box->setPercentile25Column(percentile25Column);
- box->setPercentile75Column(percentile75Column);
- box->setTitle(title);
- return addGraph(box);
-}
-
-void JKQTBasePlotter::addHorizontalBargraph(size_t xColumn, QVector yColumns, QStringList titles) {
- double w=0.9;
- double width=w/static_cast(yColumns.size());
- double s=-1.0*w/2.0+width/2.0;
- for (int i=0; isetTitle(titles[i]);
- g->setXColumn(xColumn);
- g->setYColumn(yColumns[i]);
- g->setShift(s);
- g->setWidth(width);
- //std::cout<<"shift="<(internalPlotBorderLeft), jkqtp_roundTo(internalPlotBorderTop), jkqtp_roundTo(internalPlotWidth), jkqtp_roundTo(internalPlotHeight));
painter.setClipping(true);
painter.setClipRegion(cregion);
}
- int ibTop=internalPlotBorderTop_notIncludingOutsidePlotSections-plotterStyle.plotBorderTop-internalTitleHeight;
- int ibLeft=internalPlotBorderLeft_notIncludingOutsidePlotSections-plotterStyle.plotBorderLeft;
- int ibBottom=internalPlotBorderBottom_notIncludingOutsidePlotSections-plotterStyle.plotBorderBottom;
- int ibRight=internalPlotBorderRight_notIncludingOutsidePlotSections-plotterStyle.plotBorderRight;
+ int ibTop=jkqtp_roundTo(internalPlotBorderTop_notIncludingOutsidePlotSections-plotterStyle.plotBorderTop-internalTitleHeight);
+ int ibLeft=jkqtp_roundTo(internalPlotBorderLeft_notIncludingOutsidePlotSections-plotterStyle.plotBorderLeft);
+ int ibBottom=jkqtp_roundTo(internalPlotBorderBottom_notIncludingOutsidePlotSections-plotterStyle.plotBorderBottom);
+ int ibRight=jkqtp_roundTo(internalPlotBorderRight_notIncludingOutsidePlotSections-plotterStyle.plotBorderRight);
for (int j=0; jgetOutsideSize(painter, leftSpace, rightSpace, topSpace, bottomSpace);
ibTop+=topSpace;
ibLeft+=leftSpace;
- QRect rleft(internalPlotBorderLeft+internalPlotKeyBorderLeft-ibLeft, internalPlotBorderTop, leftSpace, internalPlotHeight);
- QRect rright(internalPlotBorderLeft+internalPlotWidth+ibRight-internalPlotKeyBorderRight, internalPlotBorderTop, rightSpace, internalPlotHeight);
- QRect rtop(internalPlotBorderLeft, internalPlotBorderTop-ibTop+internalPlotKeyBorderTop, internalPlotWidth, topSpace);
- QRect rbottom(internalPlotBorderLeft, internalPlotBorderTop+internalPlotHeight+ibBottom, internalPlotWidth, bottomSpace);
- g->drawOutside(painter, rleft, rright, rtop, rbottom );
+ QRectF rleft(internalPlotBorderLeft+internalPlotKeyBorderLeft-ibLeft, internalPlotBorderTop, leftSpace, internalPlotHeight);
+ QRectF rright(internalPlotBorderLeft+internalPlotWidth+ibRight-internalPlotKeyBorderRight, internalPlotBorderTop, rightSpace, internalPlotHeight);
+ QRectF rtop(internalPlotBorderLeft, internalPlotBorderTop-ibTop+internalPlotKeyBorderTop, internalPlotWidth, topSpace);
+ QRectF rbottom(internalPlotBorderLeft, internalPlotBorderTop+internalPlotHeight+ibBottom, internalPlotWidth, bottomSpace);
+ g->drawOutside(painter, rleft.toRect(), rright.toRect(), rtop.toRect(), rbottom.toRect() );
if (plotterStyle.debugShowRegionBoxes) {
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
@@ -4515,7 +4277,8 @@ void JKQTBasePlotter::drawKeyContents(JKQTPEnhancedPainter& painter, double x, d
qDebug()<<"key_item_height="< "<getTitle().toStdString()<<": "<maxx) || start) maxx=gmaxx;
@@ -4849,10 +4614,14 @@ void JKQTBasePlotter::getGraphsXMinMax(double& minx, double& maxx, double& small
xvsgz=gmaxx; if ((xvsgz>10.0*DBL_MIN)&&((smallestGreaterZero<10.0*DBL_MIN) || (xvsgz10.0*DBL_MIN)&&((smallestGreaterZero<10.0*DBL_MIN) || (xvsgz "<getTitle().toStdString()<<": FALSE"< "<getTitle().toStdString()<<": INVISIBLE"<(i)];
}
size_t JKQTBasePlotter::getOverlayElementCount() {
- return overlays.size();
+ return static_cast(overlays.size());
}
void JKQTBasePlotter::deleteOverlayElement(size_t i, bool deletegraph) {
if (long(i)<0 || long(i)>=overlays.size()) return;
- JKQTPOverlayElement* g=overlays[i];
- overlays.removeAt(i);
+ JKQTPOverlayElement* g=overlays[static_cast(i)];
+ overlays.removeAt(static_cast(i));
if (deletegraph && g) delete g;
if (emitPlotSignals) emit overlaysUpdated();
}
@@ -5024,12 +4793,12 @@ void JKQTBasePlotter::clearOverlayElement(bool deleteGraphs) {
size_t JKQTBasePlotter::addOverlayElement(JKQTPOverlayElement *gr) {
gr->setParent(this);
- for (int i=0; i(overlays.size()); i++) {
+ if (overlays[static_cast(i)]==gr) return i;
}
overlays.push_back(gr);
if (emitPlotSignals) emit overlaysUpdated();
- return overlays.size()-1;
+ return static_cast(overlays.size()-1);
}
bool JKQTBasePlotter::containsOverlayElement(JKQTPOverlayElement *gr) const {
@@ -5049,12 +4818,12 @@ size_t JKQTBasePlotter::moveOverlayElementTop(JKQTPOverlayElement *gr) {
overlays.removeAt(i);
overlays.push_back(gr);
}
- return overlays.size()-1;
+ return static_cast(overlays.size()-1);
}
}
overlays.push_back(gr);
if (emitPlotSignals) emit overlaysUpdated();
- return overlays.size()-1;
+ return static_cast(overlays.size()-1);
}
void JKQTBasePlotter::addOverlayElements(const QList &gr) {
@@ -5068,17 +4837,17 @@ void JKQTBasePlotter::addOverlayElements(const QList &gr)
JKQTPPlotElement* JKQTBasePlotter::getGraph(size_t i) {
- return graphs[i];
+ return graphs[static_cast(i)];
};
size_t JKQTBasePlotter::getGraphCount() {
- return graphs.size();
+ return static_cast(graphs.size());
};
void JKQTBasePlotter::deleteGraph(size_t i, bool deletegraph) {
if (long(i)<0 || long(i)>=graphs.size()) return;
- JKQTPPlotElement* g=graphs[i];
- graphs.removeAt(i);
+ JKQTPPlotElement* g=graphs[static_cast(i)];
+ graphs.removeAt(static_cast(i));
if (deletegraph && g) delete g;
if (emitPlotSignals) emit plotUpdated();
};
@@ -5156,11 +4925,11 @@ void JKQTBasePlotter::setOnlyNthGraphsVisible(int start, int n)
size_t JKQTBasePlotter::addGraph(JKQTPPlotElement* gr) {
gr->setParent(this);
for (int i=0; i(i);
}
graphs.push_back(gr);
if (emitPlotSignals) emit plotUpdated();
- return graphs.size()-1;
+ return static_cast(graphs.size()-1);
};
size_t JKQTBasePlotter::moveGraphTop(JKQTPPlotElement* gr) {
@@ -5171,12 +4940,12 @@ size_t JKQTBasePlotter::moveGraphTop(JKQTPPlotElement* gr) {
graphs.removeAt(i);
graphs.push_back(gr);
}
- return graphs.size()-1;
+ return static_cast(graphs.size()-1);
}
}
graphs.push_back(gr);
if (emitPlotSignals) emit plotUpdated();
- return graphs.size()-1;
+ return static_cast(graphs.size()-1);
}
size_t JKQTBasePlotter::moveGraphBottom(JKQTPPlotElement *gr)
@@ -5193,7 +4962,7 @@ size_t JKQTBasePlotter::moveGraphBottom(JKQTPPlotElement *gr)
}
graphs.push_front(gr);
if (emitPlotSignals) emit plotUpdated();
- return graphs.size()-1;
+ return static_cast(graphs.size()-1);
};
bool JKQTBasePlotter::containsGraph(JKQTPPlotElement* gr) const {
@@ -5417,7 +5186,8 @@ void JKQTBasePlotter::setEmittingSignalsEnabled(bool enabled)
QHash JKQTBasePlotter::s_TextSizeDataCache=QHash();
-JKQTBasePlotter::textSizeKey::textSizeKey(const QFont &f, const QString &text, QPaintDevice *pd)
+JKQTBasePlotter::textSizeKey::textSizeKey(const QFont &f, const QString &text, QPaintDevice *pd):
+ text(), f(), ldpiX(0), ldpiY(0), pdpiX(0), pdpiY(0)
{
this->text=text;
this->f=f;
@@ -5434,7 +5204,8 @@ JKQTBasePlotter::textSizeKey::textSizeKey(const QFont &f, const QString &text, Q
}
}
-JKQTBasePlotter::textSizeKey::textSizeKey(const QString &fontName, double fontSize, const QString &text, QPaintDevice *pd)
+JKQTBasePlotter::textSizeKey::textSizeKey(const QString &fontName, double fontSize, const QString &text, QPaintDevice *pd):
+ text(), f(), ldpiX(0), ldpiY(0), pdpiX(0), pdpiY(0)
{
QFont f;
f.setFamily(fontName);
@@ -5460,12 +5231,10 @@ bool JKQTBasePlotter::textSizeKey::operator==(const JKQTBasePlotter::textSizeKey
}
-JKQTBasePlotter::textSizeData::textSizeData()
+JKQTBasePlotter::textSizeData::textSizeData():
+ ascent(0), descent(0), width(0), strikeoutPos(0)
{
- ascent=0;
- descent=0;
- width=0;
- strikeoutPos=0;
+
}
@@ -5480,7 +5249,7 @@ bool JKQTPPaintDeviceAdapter::useLatexParser() const
QPaintDevice *JKQTPPaintDeviceAdapter::createPaintdeviceMM(const QString &filename, double widthMM, double heightMM) const
{
- return createPaintdevice(filename, widthMM/25.4*QApplication::desktop()->logicalDpiX(), heightMM/25.4*QApplication::desktop()->logicalDpiY());
+ return createPaintdevice(filename, jkqtp_roundTo(widthMM/25.4*QApplication::desktop()->logicalDpiX()), jkqtp_roundTo(heightMM/25.4*QApplication::desktop()->logicalDpiY()));
}
JKQTPSaveDataAdapter::~JKQTPSaveDataAdapter() = default;
diff --git a/lib/jkqtplotter/jkqtpbaseplotter.h b/lib/jkqtplotter/jkqtpbaseplotter.h
index de23f4afac..7d408b97d0 100644
--- a/lib/jkqtplotter/jkqtpbaseplotter.h
+++ b/lib/jkqtplotter/jkqtpbaseplotter.h
@@ -948,135 +948,6 @@ class JKQTP_LIB_EXPORT JKQTBasePlotter: public QObject {
}
}
- /** \brief add a new graph, returns it's position in the graphs list.
- *
- * \param xColumn the column which contains the x-values of the datapoints
- * \param yColumn the column which contains the y-values of the datapoints
- * \param title a title for this specific graph which can be displayed in the key
- * \param graphStyle the way how to plot the graph
- *
- * Both point to columns in the datastore explained in the JKQTBasePlotter class. The plotWidth, color, pen style ...
- * will be extracted from the automatic plot style creation mechanism implemented in JKQTBasePlotter::getNextStyle().
- * If you want to change them either use another overloaded version of addGraph(), or use getGraph() and setGraph():
- * \code
- * size_t i=addGraph(0,1,"graph1");
- * JKQTPPlotElement gr=getGraph(i);
- * gr.color=QColor("red");
- * setGraph(i, gr);
- * \endcode
- */
- size_t addGraph(size_t xColumn, size_t yColumn, const QString& title, JKQTPGraphPlotstyle graphStyle=JKQTPLines);
-
- /** \brief add a new graph, returns it's position in the graphs list.
- *
- * \param xColumn the column which contains the x-values of the datapoints
- * \param yColumn the column which contains the y-values of the datapoints
- * \param title a title for this specific graph which can be displayed in the key
- * \param graphStyle the way how to plot the graph
- * \param symbol a symbol to use for the datapoints in some plot styles
- * \param color the color of the graph
- * \param width width (in pixel) of the graph
- * \param penstyle the drawing style (solid, dashed ...) of the graph lines.
- *
- * Both point to columns in the datastore explained in the JKQTBasePlotter class.
- * The symbolSize is set to 10 and no error information is expected.
- */
- size_t addGraph(size_t xColumn, size_t yColumn, const QString& title, JKQTPGraphPlotstyle graphStyle, QColor color, JKQTPGraphSymbols symbol=JKQTPCross, Qt::PenStyle penstyle=Qt::SolidLine, double width=2);
-
- /** \brief add a new graph with x-error information, returns it's position in the graphs list.
- *
- *
- * \param xColumn the column which contains the x-values of the datapoints
- * \param yColumn the column which contains the y-values of the datapoints
- * \param xErrorColumn the column which contains the x-value errors of the datapoints
- * \param title a title for this specific graph which can be displayed in the key
- * \param graphStyle the way how to plot the graph
- * \param errorStyle the drawing style (bars, lines ...) of the errors.
- *
- * Both point to columns in the datastore explained in the JKQTBasePlotter class.
- * The symbolSize is set to 10 and no error information is expected.
- */
- size_t addGraphWithXError(size_t xColumn, size_t yColumn, size_t xErrorColumn, const QString& title, JKQTPGraphPlotstyle graphStyle=JKQTPPoints, JKQTPErrorPlotstyle errorStyle=JKQTPErrorBars);
-
- /** \brief add a new graph with x-error information, returns it's position in the graphs list.
- *
- *
- * \param xColumn the column which contains the x-values of the datapoints
- * \param yColumn the column which contains the y-values of the datapoints
- * \param yErrorColumn the column which contains the y-value errors of the datapoints
- * \param title a title for this specific graph which can be displayed in the key
- * \param graphStyle the way how to plot the graph
- * \param errorStyle the drawing style (bars, lines ...) of the errors.
- *
- * Both point to columns in the datastore explained in the JKQTBasePlotter class.
- * The symbolSize is set to 10 and no error information is expected.
- */
- size_t addGraphWithYError(size_t xColumn, size_t yColumn, size_t yErrorColumn, const QString& title, JKQTPGraphPlotstyle graphStyle=JKQTPPoints, JKQTPErrorPlotstyle errorStyle=JKQTPErrorBars);
-
- /** \brief add a new graph with x-error information, returns it's position in the graphs list.
- *
- *
- * \param xColumn the column which contains the x-values of the datapoints
- * \param yColumn the column which contains the y-values of the datapoints
- * \param xErrorColumn the column which contains the x-value errors of the datapoints
- * \param yErrorColumn the column which contains the y-value errors of the datapoints
- * \param title a title for this specific graph which can be displayed in the key
- * \param graphStyle the way how to plot the graph
- *
- * Both point to columns in the datastore explained in the JKQTBasePlotter class.
- * The symbolSize is set to 10 and no error information is expected. The errorStyle is set to JKQTPErrorBars
- * for both directions.
- */
- size_t addGraphWithXYError(size_t xColumn, size_t yColumn, size_t xErrorColumn, size_t yErrorColumn, const QString& title, JKQTPGraphPlotstyle graphStyle=JKQTPPoints);
-
- /** \brief add a boxplot graph to the plot
- *
- * \param title title of the plot
- * \param posColumn column containing the positions
- * \param medianColumn column containing the median values
- * \param minColumn column containing the minimum values
- * \param maxColumn column containing the maximum values
- * \param percentile25Column column containing the 25% percentiles
- * \param percentile75Column column containing the 75% percentiles
- * \param meanColumn column containing the mean value (this column is optional. If you don't want a mean symbol, set this to -1
- */
- size_t addHorizontalBoxplot(QString title, int posColumn, int medianColumn, int minColumn, int maxColumn, int percentile25Column, int percentile75Column, int meanColumn=-1);
-
- /** \brief add a boxplot graph to the plot
- *
- * \param title title of the plot
- * \param posColumn column containing the positions
- * \param medianColumn column containing the median values
- * \param minColumn column containing the minimum values
- * \param maxColumn column containing the maximum values
- * \param percentile25Column column containing the 25% percentiles
- * \param percentile75Column column containing the 75% percentiles
- * \param meanColumn column containing the mean value (this column is optional. If you don't want a mean symbol, set this to -1
- */
- size_t addVerticalBoxplot(QString title, int posColumn, int medianColumn, int minColumn, int maxColumn, int percentile25Column, int percentile75Column, int meanColumn=-1);
-
- /** \brief add one bargraph for each of the given set of \f$ f(x) \f$ -values which all use one column of x-values
- *
- * \param xColumn column with the x-values, which are common to all bargraphs
- * \param yColumns columns for the y-values
- * \param titles titles of the plot
- *
- * Here is an example output:
- * \image html plot_bargraphhorplot.png
- */
- void addHorizontalBargraph(size_t xColumn, QVector yColumns, QStringList titles);
-
- /** \brief add a bargraph for the given set of \f$ f(x) \f$ -values for one column of x-values
- *
- * \param xColumns columns with the x-values
- * \param yColumn column for the y-values, which are common to all bargraphs
- * \param titles titles of the plot
- *
- * Here is an example output:
- * \image html plot_bargraphhorplot.png
- */
- void addVerticalBargraph(QVector xColumns, size_t yColumn, QStringList titles);
-
/** \brief get the maximum and minimum x-value over all graphs in the plot
* \param[out] minx smallest x value
* \param[out] maxx largest x value
@@ -1738,7 +1609,7 @@ class JKQTP_LIB_EXPORT JKQTBasePlotter: public QObject {
/*! \copydoc JKQTBasePlotterStyle::defaultTextColor */
void setDefaultTextColor(QColor __value) ;
/*! \copydoc JKQTBasePlotterStyle::defaultFontSize */
- void setDefaultTextSize(float __value) ;
+ void setDefaultTextSize(double __value) ;
/*! \copydoc JKQTBasePlotterStyle::defaultFontName */
void setDefaultTextFontName(const QString& __value) ;
/** \brief sets the current directory in which to open SaveAs ... dialogs */
@@ -2001,9 +1872,9 @@ class JKQTP_LIB_EXPORT JKQTBasePlotter: public QObject {
/** \brief list that manages all the additional graphs for \ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT "grid printing" mode */
QList gridPrintingList;
/** \brief this list contains all the rows of the current \ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT "grid printing" and stores its heights */
- QList gridPrintingRows;
+ QList gridPrintingRows;
/** \brief this list contains all the columns of the current \ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT "grid printing" and stores its widths */
- QList gridPrintingColumns;
+ QList gridPrintingColumns;
/** \brief size of all plots in \ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT "grid printing" mode, filled by gridPrintingCalc() */
QSizeF gridPrintingSize;
diff --git a/lib/jkqtplotter/jkqtpbaseplotterstyle.cpp b/lib/jkqtplotter/jkqtpbaseplotterstyle.cpp
index 453fa075ad..699ba185bf 100644
--- a/lib/jkqtplotter/jkqtpbaseplotterstyle.cpp
+++ b/lib/jkqtplotter/jkqtpbaseplotterstyle.cpp
@@ -34,6 +34,7 @@ JKQTBasePlotterStyle::JKQTBasePlotterStyle():
graphFillColorDerivationMode(JKQTPFFCMLighterColor),
graphErrorColorDerivationMode(JKQTPFFCMDarkerColor),
graphErrorFillColorDerivationMode(JKQTPFFCMEvenLighterColor),
+ defaultGraphColors(), defaultGraphPenStyles(), defaultGraphSymbols(), defaultGraphFillStyles(),
keyStyle(*this),
xAxisStyle(*this),
yAxisStyle(*this),
diff --git a/lib/jkqtplotter/jkqtpcoordinateaxes.cpp b/lib/jkqtplotter/jkqtpcoordinateaxes.cpp
index ea012a872a..2f9cd96cea 100644
--- a/lib/jkqtplotter/jkqtpcoordinateaxes.cpp
+++ b/lib/jkqtplotter/jkqtpcoordinateaxes.cpp
@@ -29,44 +29,40 @@
//#undef SHOW_JKQTPLOTTER_DEBUG
//#define SHOW_JKQTPLOTTER_DEBUG
-JKQTPCoordinateAxis::JKQTPCoordinateAxis(JKQTBasePlotter* parent):
- QObject(parent)
+JKQTPCoordinateAxis::JKQTPCoordinateAxis(JKQTBasePlotter* _parent):
+ QObject(_parent),
+ paramsChanged(true),
+ doUpdateScaling(true),
+ tickLabels(),
+ parent(_parent),
+ axismin(-10),
+ axismax(10),
+ axisabsoultemin(-DBL_MAX/100.),
+ axisabsoultemax(DBL_MAX/100.0),
+ axisStyle(),
+ axisMinWidth(-1),
+ width(20),
+ scale(0),
+ offset(0),
+ inverted(false),
+ tickStart(1),
+ autoAxisSpacing(true),
+ logAxis(false),
+ logAxisBase(10),
+ userTickSpacing(1),
+ userLogTickSpacing(10),
+ tickSpacing(0),
+ tickSpacingLog(10),
+ axisLabel(),
+ axisPrefix(),
+ scaleSign(1)
{
- this->parent=parent;
- axisPrefix="";
- scaleSign=1;
- doUpdateScaling=true;
-
- axismin=-10;
- axismax=10;
- axisabsoultemin=-DBL_MAX/100.0;
- axisabsoultemax=DBL_MAX/100.0;
- axisMinWidth=-1;
-
- width=20;
-
- scale=0;
- offset=0;
- inverted=false;
-
- tickSpacing=0;
- tickSpacingLog=10;
- tickStart=0;
-
- autoAxisSpacing=true;
- logAxis=false;
- logAxisBase=10;
- userTickSpacing=1;
- userLogTickSpacing=10;
-
- axisLabel="";
-
-
- paramsChanged=true;
}
-JKQTPCoordinateAxis::~JKQTPCoordinateAxis() = default;
+JKQTPCoordinateAxis::~JKQTPCoordinateAxis() {
+
+}
void JKQTPCoordinateAxis::setParent(JKQTBasePlotter* parent) {
this->parent=parent;
@@ -1617,14 +1613,14 @@ void JKQTPVerticalAxis::drawAxes(JKQTPEnhancedPainter& painter) {
-JKQTPVerticalIndependentAxis::JKQTPVerticalIndependentAxis(double axisOffset, double axisWidth, double otherAxisOffset, double otherAxisWidth, JKQTBasePlotter* parent):
- JKQTPVerticalAxis(parent)
+JKQTPVerticalIndependentAxis::JKQTPVerticalIndependentAxis(double _axisOffset, double _axisWidth, double _otherAxisOffset, double _otherAxisWidth, JKQTBasePlotter* parent):
+ JKQTPVerticalAxis(parent),
+ axisOffset(_axisOffset),
+ axisWidth(_axisWidth),
+ otherAxisWidth(_otherAxisOffset),
+ otherAxisOffset(_otherAxisWidth),
+ otherAxisInverted(false)
{
- this->axisOffset=axisOffset;
- this->axisWidth=axisWidth;
- this->otherAxisOffset=otherAxisOffset;
- this->otherAxisWidth=otherAxisWidth;
- this->otherAxisInverted=false;
if (parent) {
axisStyle=parent->getCurrentPlotterStyle().rightColorbarAxisStyle;
} else {
@@ -1716,7 +1712,7 @@ QSizeF JKQTPHorizontalAxis::getSize1(JKQTPEnhancedPainter& painter) {
if (JKQTPCADrawModeHasTickLabels(axisStyle.drawMode1)) {
ptwidth+=axisStyle.labelDistance;
// find out size of axis label
- labwidth+=parent->getTextSizeSize(getParent()->getCurrentPlotterStyle().defaultFontName, axisStyle.labelFontSize*parent->getFontSizeMultiplier(), axisLabel, painter).width();
+ labwidth+=parent->getTextSizeSize(getParent()->getCurrentPlotterStyle().defaultFontName, axisStyle.labelFontSize*parent->getFontSizeMultiplier(), axisLabel, painter).height();
}
return QSizeF(getParentPlotWidth(), parent->pt2px(painter, ptwidth)+labwidth);
@@ -1735,7 +1731,7 @@ QSizeF JKQTPHorizontalAxis::getSize2(JKQTPEnhancedPainter& painter) {
if (JKQTPCADrawModeHasTickLabels(axisStyle.drawMode2)) {
ptwidth+=axisStyle.labelDistance;
// find out size of axis label
- labwidth+=parent->getTextSizeSize(getParent()->getCurrentPlotterStyle().defaultFontName, axisStyle.labelFontSize*parent->getFontSizeMultiplier(), axisLabel, painter).width();
+ labwidth+=parent->getTextSizeSize(getParent()->getCurrentPlotterStyle().defaultFontName, axisStyle.labelFontSize*parent->getFontSizeMultiplier(), axisLabel, painter).height();
}
return QSizeF(getParentPlotWidth(), parent->pt2px(painter, ptwidth)+labwidth);
@@ -2198,14 +2194,14 @@ void JKQTPHorizontalAxis::drawAxes(JKQTPEnhancedPainter& painter) {
-JKQTPHorizontalIndependentAxis::JKQTPHorizontalIndependentAxis(double axisOffset, double axisWidth, double otherAxisOffset, double otherAxisWidth, JKQTBasePlotter* parent):
- JKQTPHorizontalAxis(parent)
+JKQTPHorizontalIndependentAxis::JKQTPHorizontalIndependentAxis(double _axisOffset, double _axisWidth, double _otherAxisOffset, double _otherAxisWidth, JKQTBasePlotter* parent):
+ JKQTPHorizontalAxis(parent),
+ axisOffset(_axisOffset),
+ axisWidth(_axisWidth),
+ otherAxisWidth(_otherAxisOffset),
+ otherAxisOffset(_otherAxisWidth),
+ otherAxisInverted(false)
{
- this->axisOffset=axisOffset;
- this->axisWidth=axisWidth;
- this->otherAxisOffset=otherAxisOffset;
- this->otherAxisWidth=otherAxisWidth;
- this->otherAxisInverted=false;
if (parent) {
axisStyle=parent->getCurrentPlotterStyle().topColorbarAxisStyle;
} else {
diff --git a/lib/jkqtplotter/jkqtpdatastorage.h b/lib/jkqtplotter/jkqtpdatastorage.h
index 5fad0fa6c1..a7424141d1 100644
--- a/lib/jkqtplotter/jkqtpdatastorage.h
+++ b/lib/jkqtplotter/jkqtpdatastorage.h
@@ -1579,6 +1579,7 @@ class JKQTP_LIB_EXPORT JKQTPColumn {
};
+#pragma pack(push,1)
/** \brief iterator over the data in the column of a JKQTPDatastore
* \ingroup jkqtpdatastorage
*
@@ -2245,7 +2246,7 @@ class JKQTP_LIB_EXPORT JKQTPDatastoreItem {
inline void erase(size_t row) {
JKQTPASSERT(isVector());
datavec.erase(datavec.begin()+row, datavec.end());
- rows=static_cast(datavec.size());
+ rows=static_cast(datavec.size());
data=datavec.data();
}
/** \brief if \c isValid() : erase all rows (and including) from \a row to \a rowEnd */
@@ -2256,7 +2257,7 @@ class JKQTP_LIB_EXPORT JKQTPDatastoreItem {
JKQTPASSERT(isVector());
if (rowEnd>=static_cast(datavec.size())) datavec.erase(datavec.begin()+row, datavec.end());
else datavec.erase(datavec.begin()+row, datavec.begin()+rowEnd);
- rows=static_cast(datavec.size());
+ rows=static_cast(datavec.size());
data=datavec.data();
}
}
@@ -2397,6 +2398,7 @@ class JKQTP_LIB_EXPORT JKQTPDatastoreItem {
return false;
}
};
+#pragma pack(pop)
/** \brief QAbstractTableModel descendent that allows to view data in a JKQTPDatastore
diff --git a/lib/jkqtplotter/jkqtplotter.cpp b/lib/jkqtplotter/jkqtplotter.cpp
index 187890f377..848a037d4d 100644
--- a/lib/jkqtplotter/jkqtplotter.cpp
+++ b/lib/jkqtplotter/jkqtplotter.cpp
@@ -43,25 +43,37 @@
**************************************************************************************************************************/
JKQTPlotter::JKQTPlotter(bool datastore_internal, QWidget* parent, JKQTPDatastore* datast):
QWidget(parent, Qt::Widget),
- plotterStyle(JKQTPGetSystemDefaultStyle())
+ currentMouseDragAction(),
+ doDrawing(false),
+ plotter(nullptr),
+ mouseDragingRectangle(false),
+ mouseDragRectXStart(0), mouseDragRectXStartPixel(0), mouseDragRectXEndPixel(0),
+ mouseDragRectYEndPixel(0), mouseDragRectXEnd(0), mouseDragRectYStart(0),
+ mouseDragRectYStartPixel(0), mouseDragRectYEnd(0),
+ mouseDragMarkers(),
+ image(), imageNoOverlays(), oldImage(),
+ menuSpecialContextMenu(nullptr),toolbar(nullptr), masterPlotterX(nullptr), masterPlotterY(nullptr),
+ mousePosX(0), mousePosY(0),
+ magnification(1),
+ minSize(),
+ contextMenu(nullptr),
+ contextMenuMode(JKQTPContextMenuModes::jkqtpcmmStandardContextMenu),
+ mouseContextX(0), mouseContextY(0), mouseLastClickX(0), mouseLastClickY(0),
+ contextSubMenus(),
+ plotterStyle(JKQTPGetSystemDefaultStyle()),
+ resizeTimer(), registeredOverrideMouseDragActionModes(),
+ actgrpMouseLeft(nullptr), actMouseLeftAsDefault(nullptr), actMouseLeftAsRuler(nullptr), actMouseLeftAsToolTip(nullptr), actMouseLeftAsZoomRect(nullptr), actMouseLeftAsPanView(nullptr)
{
initJKQTPlotterResources();
- menuSpecialContextMenu=nullptr;
- mouseContextX=0;
- mouseContextY=0;
setParent(parent);
connect(&resizeTimer, SIGNAL(timeout()), this, SLOT(delayedResizeEvent()));
- doDrawing=false;
- magnification=1;
+
plotter=new JKQTBasePlotter(datastore_internal, this, datast);
plotter->setEmittingSignalsEnabled(false);
fixBasePlotterSettings();
- mousePosX=0;
- mousePosY=0;
-
connect(plotter, SIGNAL(plotUpdated()), this, SLOT(redrawPlot()));
connect(plotter, SIGNAL(overlaysUpdated()), this, SLOT(redrawOverlays()));
connect(plotter, SIGNAL(beforePlotScalingRecalculate()), this, SLOT(intBeforePlotScalingRecalculate()));
@@ -70,10 +82,6 @@ JKQTPlotter::JKQTPlotter(bool datastore_internal, QWidget* parent, JKQTPDatastor
image=QImage(width(), height(), QImage::Format_ARGB32);
oldImage=image;
imageNoOverlays=image;
- mouseDragingRectangle=false;
-
- // set default user-interactions:
- contextMenuMode=JKQTPContextMenuModes::jkqtpcmmStandardContextMenu;
// enable mouse-tracking, so mouseMoved-Events can be caught
setMouseTracking(true);
@@ -334,17 +342,23 @@ JKQTPUserActionMarkerType JKQTPlotter::getUserActionMarkerType() const
void JKQTPlotter::registerMouseWheelAction(Qt::KeyboardModifiers modifier, JKQTPMouseWheelActions action)
{
+ qDebug()<<"registerMouseWheelAction("<x2p(mouseDragRectXStart)*magnification;
double y1=plotter->y2p(mouseDragRectYStart)*magnification;
double x2=plotter->x2p(mouseDragRectXEnd)*magnification;
@@ -708,10 +722,10 @@ void JKQTPlotter::mouseMoveEvent ( QMouseEvent * event ) {
if (currentMouseDragAction.mode==jkqtpmdaZoomByRectangle) {
emit plotNewZoomRectangle(mouseDragRectXStart, mouseDragRectXEnd, mouseDragRectYStart, mouseDragRectYEnd, event->modifiers());
}
- if ((currentMouseDragAction.mode==jkqtpmdaScribbleForEvents) && ((mouseDragRectXStart!=mouseDragRectXEnd) || (mouseDragRectYStart!=mouseDragRectYEnd)) ) {
+ if ((currentMouseDragAction.mode==jkqtpmdaScribbleForEvents) && (jkqtp_approximatelyUnequal(mouseDragRectXStart,mouseDragRectXEnd) || jkqtp_approximatelyUnequal(mouseDragRectYStart,mouseDragRectYEnd)) ) {
emit userScribbleClick(mouseDragRectXEnd, mouseDragRectYEnd, event->modifiers(), false, false);
}
- if ((currentMouseDragAction.mode==jkqtpmdaPanPlotOnMove) && ((mouseDragRectXStart!=mouseDragRectXEnd) || (mouseDragRectYStart!=mouseDragRectYEnd)) ) {
+ if ((currentMouseDragAction.mode==jkqtpmdaPanPlotOnMove) && (jkqtp_approximatelyUnequal(mouseDragRectXStart,mouseDragRectXEnd) || jkqtp_approximatelyUnequal(mouseDragRectYStart,mouseDragRectYEnd)) ) {
QRectF zoomRect= QRectF(QPointF(plotter->x2p(getXAxis()->getMin()),plotter->y2p(getYAxis()->getMax())), QPointF(plotter->x2p(getXAxis()->getMax()),plotter->y2p(getYAxis()->getMin())));
if ( (mouseLastClickX/magnificationgetInternalPlotBorderLeft()) || (mouseLastClickX/magnification>plotter->getPlotWidth()+plotter->getInternalPlotBorderLeft()) ) {
zoomRect.translate(0, mouseDragRectYStartPixel-mouseDragRectYEndPixel);
@@ -797,7 +811,7 @@ void JKQTPlotter::mouseReleaseEvent ( QMouseEvent * event ){
double x2=mouseDragRectXEnd;
double y2=mouseDragRectYEnd;
- if ((mouseDragRectXStart!=mouseDragRectXEnd) && (mouseDragRectYStart!=mouseDragRectYEnd)) {
+ if (jkqtp_approximatelyUnequal(mouseDragRectXStart,mouseDragRectXEnd) && jkqtp_approximatelyUnequal(mouseDragRectYStart,mouseDragRectYEnd)) {
if (currentMouseDragAction.mode==jkqtpmdaZoomByRectangle) {
double xmin=mouseDragRectXStart;
double xmax=mouseDragRectXEnd;
@@ -913,11 +927,15 @@ void JKQTPlotter::keyReleaseEvent(QKeyEvent *event) {
}
void JKQTPlotter::wheelEvent ( QWheelEvent * event ) {
- //qDebug()<<"wheelEvent()";
+ //qDebug()<<"wheelEvent("<modifiers()<<"): plotterStyle.registeredMouseWheelActions="<modifiers());
- if (itAction!=plotterStyle.registeredMouseWheelActions.end()) {
+ //qDebug()<<"wheelEvent("<modifiers()<<"): plotterStyle.registeredMouseWheelActions="<modifiers()<<"): itAction="<modifiers()<<"):ZoomByWheel";
double factor=pow(2.0, 1.0*static_cast(event->delta())/120.0)*2.0;
double xmin=plotter->p2x(static_cast(event->x())/magnification-static_cast(plotter->getPlotWidth())/factor);
double xmax=plotter->p2x(static_cast(event->x())/magnification+static_cast(plotter->getPlotWidth())/factor);
@@ -932,7 +950,8 @@ void JKQTPlotter::wheelEvent ( QWheelEvent * event ) {
}
plotter->setXY(xmin, xmax, ymin, ymax);
} else if (itAction.value()==JKQTPMouseWheelActions::jkqtpmwaPanByWheel) {
- //qDebug()<<"wheelEvent():PanByWheel";
+ //} else if (act==JKQTPMouseWheelActions::jkqtpmwaPanByWheel) {
+ //qDebug()<<"wheelEvent("<modifiers()<<"):PanByWheel";
QRectF zoomRect= QRectF(QPointF(plotter->x2p(getXAxis()->getMin()),plotter->y2p(getYAxis()->getMax())), QPointF(plotter->x2p(getXAxis()->getMax()),plotter->y2p(getYAxis()->getMin())));
QPointF d=QPointF(event->angleDelta().x()/120.0*zoomRect.width()/10.0,
event->angleDelta().y()/120.0*zoomRect.height()/10.0);
@@ -1131,7 +1150,7 @@ void JKQTPlotter::redrawPlot() {
if (!doDrawing) return;
disconnect(plotter, SIGNAL(plotUpdated()), this, SLOT(redrawPlot()));
disconnect(plotter, SIGNAL(overlaysUpdated()), this, SLOT(redrawOverlays()));
- plotter->setWidgetSize(width()/magnification, height()/magnification-getPlotYOffset());
+ plotter->setWidgetSize(jkqtp_roundTo(width()/magnification), jkqtp_roundTo(height()/magnification-getPlotYOffset()));
JKQTPEnhancedPainter painter(&image);
if (painter.isActive()) {
painter.scale(magnification, magnification);
@@ -1167,7 +1186,7 @@ void JKQTPlotter::paintEvent(QPaintEvent *event){
p->drawRect(geometry());
p->restore();
if (plotterStyle.displayMousePosition ) {
- p->drawText(plotter->getInternalPlotBorderLeft(), getPlotYOffset()-1, plotterStyle.mousePositionTemplate.arg(mousePosX).arg(mousePosY));
+ p->drawText(QPointF(plotter->getInternalPlotBorderLeft(), getPlotYOffset()-1), plotterStyle.mousePositionTemplate.arg(mousePosX).arg(mousePosY));
}
int plotImageWidth=width();
@@ -1205,7 +1224,7 @@ void JKQTPlotter::resizeEvent(QResizeEvent *event) {
}
//updateGeometry();
- //std::cout<<"resize DONE\n";
+ //qDebug()<<"resize DONE width()="<getInternalPlotBorderLeft()+plotter->getInternalPlotBorderRight()+10, plotter->getInternalPlotBorderTop()+plotter->getInternalPlotBorderBottom()+10);
+ minSize=QSizeF(plotter->getInternalPlotBorderLeft()+plotter->getInternalPlotBorderRight()+10, plotter->getInternalPlotBorderTop()+plotter->getInternalPlotBorderBottom()+10).toSize();
}
void JKQTPlotter::intBeforePlotScalingRecalculate() {
@@ -1650,25 +1669,46 @@ void JKQTPlotter::openStandardAndSpecialContextMenu(int x, int y)
JKQTPMouseDragActionsHashMapIterator JKQTPlotter::findMatchingMouseDragAction(Qt::MouseButton button, Qt::KeyboardModifiers modifiers, bool* found) const
{
- auto it=registeredOverrideMouseDragActionModes.find(qMakePair(button, modifiers));
- if (it!=registeredOverrideMouseDragActionModes.end()) {
- if (found) *found=true;
- return it;
+ JKQTPMouseDragActionsHashMapIterator it=registeredOverrideMouseDragActionModes.begin();
+ while (it!=registeredOverrideMouseDragActionModes.end() ) {
+ if (it.key()==qMakePair(button, modifiers)) {
+ if (found) *found=true;
+ return it;
+ }
+ ++it;
}
- auto itt=plotterStyle.registeredMouseDragActionModes.find(qMakePair(button, modifiers));
- if (found) *found=(itt!=plotterStyle.registeredMouseDragActionModes.end());
- return itt;
+ it=plotterStyle.registeredMouseDragActionModes.begin();
+ while (it!=plotterStyle.registeredMouseDragActionModes.end() ) {
+ if (it.key()==qMakePair(button, modifiers)) {
+ if (found) *found=true;
+ return it;
+ }
+ ++it;
+ }
+ if (found) *found=false;
+ return plotterStyle.registeredMouseDragActionModes.end();
}
JKQTPMouseDoubleClickActionsHashMapIterator JKQTPlotter::findMatchingMouseDoubleClickAction(Qt::MouseButton button, Qt::KeyboardModifiers modifiers) const
{
- return plotterStyle.registeredMouseDoubleClickActions.find(qMakePair(button, modifiers));
+ for (JKQTPMouseDoubleClickActionsHashMapIterator it=plotterStyle.registeredMouseDoubleClickActions.begin(); it!=plotterStyle.registeredMouseDoubleClickActions.end(); ++it) {
+ if (it.key()==qMakePair(button, modifiers)) {
+ return it;
+ }
+ }
+ return plotterStyle.registeredMouseDoubleClickActions.end();
}
JKQTPMouseWheelActionsHashMapIterator JKQTPlotter::findMatchingMouseWheelAction(Qt::KeyboardModifiers modifiers) const
{
- //qDebug()<<"findMatchingMouseWheelAction("<
+#include
#include "jkqtcommon/jkqttools.h"
#include "jkqtplotter/jkqtptools.h"
@@ -21,13 +22,17 @@ JKQTPlotterStyle::JKQTPlotterStyle():
displayMousePosition(true),
toolbarEnabled(true),
toolbarAlwaysOn(false),
- usePaletteColors(true)
+ usePaletteColors(true),
+ registeredMouseDragActionModes(),
+ registeredMouseWheelActions(),
+ registeredMouseDoubleClickActions()
{
// default user-actions:
registeredMouseDragActionModes[qMakePair(Qt::LeftButton, Qt::NoModifier)]=JKQTPMouseDragActions::jkqtpmdaZoomByRectangle;
registeredMouseDragActionModes[qMakePair(Qt::LeftButton, Qt::ControlModifier)]=JKQTPMouseDragActions::jkqtpmdaPanPlotOnMove;
registeredMouseDoubleClickActions[qMakePair(Qt::LeftButton, Qt::NoModifier)]=JKQTPMouseDoubleClickActions::jkqtpdcaClickMovesViewport;
registeredMouseWheelActions[Qt::NoModifier]=JKQTPMouseWheelActions::jkqtpmwaZoomByWheel;
+ //qDebug()<<"JKQTPlotterStyle(): registeredMouseWheelActions="<