Merge pull request #1 from srazi/win-msvc

Support compiling under Windows using MSVC2015
This commit is contained in:
Jan W. Krieger 2018-12-10 21:08:39 +01:00 committed by GitHub
commit 010f513b31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 62 additions and 45 deletions

View File

@ -1,6 +1,14 @@
!win32-msvc* {
QMAKE_CXXFLAGS += -fexceptions QMAKE_CXXFLAGS += -fexceptions
} else {
QMAKE_CXXFLAGS += /EHsc
# To enable M_PI, M_E,...
DEFINES += _USE_MATH_DEFINES
# To fix error: C2338: va_start argument must not
# have reference type and must not be parenthesized
DEFINES += _CRT_NO_VA_START_VALIDATION
}
HEADERS += $$PWD/jkqtplotter/jkqtpbaseplotter.h \ HEADERS += $$PWD/jkqtplotter/jkqtpbaseplotter.h \
$$PWD/jkqtplotter/jkqtpdatastorage.h \ $$PWD/jkqtplotter/jkqtpdatastorage.h \

View File

@ -602,7 +602,7 @@ QPen JKQTPbarVerticalGraph::getLinePen(JKQTPEnhancedPainter& painter) const {
return p; return p;
} }
double JKQTPbarVerticalGraph::getParentStackedMax(int index) const double JKQTPbarVerticalGraph::getParentStackedMax(int /*index*/) const
{ {
return false; return false;
} }

View File

@ -604,9 +604,6 @@ void JKQTPfilledVerticalRangeGraph::draw(JKQTPEnhancedPainter &painter)
// then the whole thing is drawn // then the whole thing is drawn
QPolygonF poly_all, phigh, plow; QPolygonF poly_all, phigh, plow;
double xold=-1;
bool first=true;
intSortData(); intSortData();
for (int iii=imin; iii<imax; iii++) { for (int iii=imin; iii<imax; iii++) {
int i=qBound(imin, getDataIndex(iii), imax); int i=qBound(imin, getDataIndex(iii), imax);
@ -679,7 +676,7 @@ QColor JKQTPfilledVerticalRangeGraph::getKeyLabelColor()
return color; return color;
} }
QBrush JKQTPfilledVerticalRangeGraph::getBrush(JKQTPEnhancedPainter &painter) const QBrush JKQTPfilledVerticalRangeGraph::getBrush(JKQTPEnhancedPainter &/*painter*/) const
{ {
QBrush b; QBrush b;
b.setColor(fillColor); b.setColor(fillColor);

View File

@ -1962,8 +1962,9 @@ void JKQTPColorPaletteTools::cbDrawOutside(JKQTPEnhancedPainter& painter, QRect
if (colorBarRightVisible) { if (colorBarRightVisible) {
painter.save(); painter.save();
uint8_t h=1; static const uint8_t h=1;
uint8_t d[200*h];//, dd[200*h]; static const uint8_t dSize = 200*h;
uint8_t d[dSize];//, dd[200*h];
for (int i=0; i<200; i++) { for (int i=0; i<200; i++) {
for (int j=0; j<h; j++) { for (int j=0; j<h; j++) {
d[i*h+j]=i; d[i*h+j]=i;
@ -2023,9 +2024,9 @@ void JKQTPColorPaletteTools::cbDrawOutside(JKQTPEnhancedPainter& painter, QRect
JKQTPimagePlot_array2image<uint8_t>(d, 200, 1, b, palette, 0, 199);*/ JKQTPimagePlot_array2image<uint8_t>(d, 200, 1, b, palette, 0, 199);*/
uint8_t h=1; static const uint8_t h=1;
static const uint8_t dSize = 200*h;
uint8_t d[200*h];//, dd[200*h]; uint8_t d[dSize];//, dd[200*h];
for (int i=0; i<200; i++) { for (int i=0; i<200; i++) {
for (int j=0; j<h; j++) { for (int j=0; j<h; j++) {
d[i*h+j]=i; d[i*h+j]=i;

View File

@ -221,7 +221,7 @@ inline double JKQTPimagePlot_getImageMin(T* dbl, int width, int height)
for (int i=1; i<width*height; ++i) for (int i=1; i<width*height; ++i)
{ {
register T v=dbl[i]; register T v=dbl[i];
if (!(std::isnan(v) || std::isinf(v))) { if (!(std::isnan(static_cast<long double>(v)) || std::isinf(static_cast<long double>(v)))) {
if (first) { if (first) {
min=max=v; min=max=v;
first=false; first=false;
@ -252,7 +252,7 @@ inline double JKQTPimagePlot_getImageMax(T* dbl, int width, int height)
for (int i=1; i<width*height; ++i) for (int i=1; i<width*height; ++i)
{ {
register T v=dbl[i]; register T v=dbl[i];
if (!(std::isnan(v) || std::isinf(v))) { if (!(std::isnan(static_cast<long double>(v)) || std::isinf(static_cast<long double>(v)))) {
if (first) { if (first) {
min=max=v; min=max=v;
first=false; first=false;
@ -296,7 +296,7 @@ inline void JKQTPimagePlot_array2RGBimage(T* dbl_in, int width, int height, QIma
for (int i=1; i<width*height; ++i) for (int i=1; i<width*height; ++i)
{ {
register T v=dbl_in[i]; register T v=dbl_in[i];
if (std::isfinite(v)) { if (std::isfinite(static_cast<long double>(v))) {
if (first) { if (first) {
min=max=v; min=max=v;
first=false; first=false;
@ -585,7 +585,7 @@ inline void JKQTPimagePlot_array2image(T* dbl_in, int width, int height, QImage
for (int i=1; i<width*height; ++i) for (int i=1; i<width*height; ++i)
{ {
register T v=dbl_in[i]; register T v=dbl_in[i];
if (!(std::isnan(v) || std::isinf(v))) { if (!(std::isnan(static_cast<long double>(v)) || std::isinf(static_cast<long double>(v)))) {
if (first) { if (first) {
min=max=v; min=max=v;
first=false; first=false;

View File

@ -43,7 +43,7 @@ double JKQTPxParsedFunctionLineGraphFunction(double x, void* data) {
return r.num; return r.num;
} }
} }
} catch(std::exception& E) { } catch(std::exception& /*E*/) {
//qDebug()<<QString("parser error: %1").arg(E.what()); //qDebug()<<QString("parser error: %1").arg(E.what());
/*ok= QMessageBox::critical(this, tr("QuickFit-table"), /*ok= QMessageBox::critical(this, tr("QuickFit-table"),
tr("An error occured while parsing the expression '%1' in cell (row, column)=(%3, %4):\n%2\n\n\"OK\" will still go on evaluating\n\"Cancel\" will cancel evaluation for the rest of the cells.").arg(dlgMathExpression->getExpression()).arg(E.what()).arg(row).arg(column), tr("An error occured while parsing the expression '%1' in cell (row, column)=(%3, %4):\n%2\n\n\"OK\" will still go on evaluating\n\"Cancel\" will cancel evaluation for the rest of the cells.").arg(dlgMathExpression->getExpression()).arg(E.what()).arg(row).arg(column),
@ -138,7 +138,7 @@ void JKQTPxParsedFunctionLineGraph::createPlotData(bool /*collectParams*/)
//qDebug()<<"createPlotData(): adding variables: "<<t<<"ms"; //qDebug()<<"createPlotData(): adding variables: "<<t<<"ms";
fdata.node=fdata.parser->parse(function.toStdString()); fdata.node=fdata.parser->parse(function.toStdString());
//qDebug()<<"createPlotData(): parsing: "<<timer.elapsed()-t<<"ms"; //qDebug()<<"createPlotData(): parsing: "<<timer.elapsed()-t<<"ms";
} catch(std::exception& E) { } catch(std::exception& /*E*/) {
//qDebug()<<QString("parser error: %1").arg(E.what()); //qDebug()<<QString("parser error: %1").arg(E.what());
} }
@ -171,7 +171,7 @@ void JKQTPxParsedFunctionLineGraph::createPlotData(bool /*collectParams*/)
//qDebug()<<"createPlotData(): adding variables: "<<t-t0<<"ms"; //qDebug()<<"createPlotData(): adding variables: "<<t-t0<<"ms";
efdata.node=efdata.parser->parse(errorFunction.toStdString()); efdata.node=efdata.parser->parse(errorFunction.toStdString());
//qDebug()<<"createPlotData(): parsing: "<<timer.elapsed()-t<<"ms"; //qDebug()<<"createPlotData(): parsing: "<<timer.elapsed()-t<<"ms";
} catch(std::exception& E) { } catch(std::exception& /*E*/) {
//qDebug()<<QString("parser error: %1").arg(E.what()); //qDebug()<<QString("parser error: %1").arg(E.what());
} }

View File

@ -39,10 +39,8 @@
#include <cfloat> #include <cfloat>
#include <QComboBox> #include <QComboBox>
#include <QPrinter> #include <QPrinter>
#include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <dirent.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
@ -104,11 +102,14 @@
/** \brief a separator between two directories in a path between \c ' quotes */ /** \brief a separator between two directories in a path between \c ' quotes */
#define JKQTPPATHSEPARATOR_CHAR '\\' #define JKQTPPATHSEPARATOR_CHAR '\\'
#include<windows.h> #include<windows.h>
#include <io.h>
#else #else
/** \brief a separator between two directories in a path between \c " quotes */ /** \brief a separator between two directories in a path between \c " quotes */
#define JKQTPPATHSEPARATOR_STRING "/" #define JKQTPPATHSEPARATOR_STRING "/"
/** \brief a separator between two directories in a path between \c ' quotes */ /** \brief a separator between two directories in a path between \c ' quotes */
#define JKQTPPATHSEPARATOR_CHAR '/' #define JKQTPPATHSEPARATOR_CHAR '/'
#include <unistd.h>
#include <dirent.h>
#endif #endif

View File

@ -30,9 +30,9 @@ TestWidgetGeometry::TestWidgetGeometry(QWidget *parent) :
plotGeo->get_plotter()->set_axisAspectRatio(1); plotGeo->get_plotter()->set_axisAspectRatio(1);
JKQTPgeoLine* line1=new JKQTPgeoLine(plotGeo->get_plotter(), -1, -2, 2, 1.5); // JKQTPgeoLine* line1=new JKQTPgeoLine(plotGeo->get_plotter(), -1, -2, 2, 1.5);
//plotGeo->get_plotter()->addGraph(line1); //plotGeo->get_plotter()->addGraph(line1);
JKQTPgeoLine* line2=new JKQTPgeoLine(plotGeo->get_plotter(), 1, -5, 4, 3, QColor("blue"), 4); // JKQTPgeoLine* line2=new JKQTPgeoLine(plotGeo->get_plotter(), 1, -5, 4, 3, QColor("blue"), 4);
//plotGeo->get_plotter()->addGraph(line2); //plotGeo->get_plotter()->addGraph(line2);
JKQTPgeoRectangle* rect1=new JKQTPgeoRectangle(plotGeo->get_plotter(), 1,1,2,2, QColor("blue"),2, Qt::SolidLine, QColor("lightblue")); JKQTPgeoRectangle* rect1=new JKQTPgeoRectangle(plotGeo->get_plotter(), 1,1,2,2, QColor("blue"),2, Qt::SolidLine, QColor("lightblue"));
@ -55,18 +55,18 @@ TestWidgetGeometry::TestWidgetGeometry(QWidget *parent) :
p.append(QPointF(0,-2)); p.append(QPointF(0,-2));
p.append(QPointF(M_PI,5.5)); p.append(QPointF(M_PI,5.5));
JKQTPgeoPolygon* poly=new JKQTPgeoPolygon(plotGeo->get_plotter(), p, QColor("black"), 1.5, Qt::SolidLine, QColor(128,128,0,128)); // JKQTPgeoPolygon* poly=new JKQTPgeoPolygon(plotGeo->get_plotter(), p, QColor("black"), 1.5, Qt::SolidLine, QColor(128,128,0,128));
//plotGeo->get_plotter()->addGraph(poly); //plotGeo->get_plotter()->addGraph(poly);
JKQTPgeoLines* lines=new JKQTPgeoLines(plotGeo->get_plotter(), p, QColor(255,255,0), 3); // JKQTPgeoLines* lines=new JKQTPgeoLines(plotGeo->get_plotter(), p, QColor(255,255,0), 3);
//plotGeo->get_plotter()->addGraph(lines); //plotGeo->get_plotter()->addGraph(lines);
JKQTPgeoEllipse* ell1=new JKQTPgeoEllipse(plotGeo->get_plotter(), 0,0,2,4, QColor("black"),1.5, Qt::DotLine); JKQTPgeoEllipse* ell1=new JKQTPgeoEllipse(plotGeo->get_plotter(), 0,0,2,4, QColor("black"),1.5, Qt::DotLine);
plotGeo->get_plotter()->addGraph(ell1); plotGeo->get_plotter()->addGraph(ell1);
JKQTPgeoArc* arc=new JKQTPgeoArc(plotGeo->get_plotter(), 0,0,2,4,0, 135, QColor("blue"),3, Qt::SolidLine); // JKQTPgeoArc* arc=new JKQTPgeoArc(plotGeo->get_plotter(), 0,0,2,4,0, 135, QColor("blue"),3, Qt::SolidLine);
//plotGeo->get_plotter()->addGraph(arc); //plotGeo->get_plotter()->addGraph(arc);
JKQTPgeoPie* pie=new JKQTPgeoPie(plotGeo->get_plotter(), 0,0,2,4,35, 98, QColor("blue"),3, Qt::SolidLine, QColor(0,0,255,127)); // JKQTPgeoPie* pie=new JKQTPgeoPie(plotGeo->get_plotter(), 0,0,2,4,35, 98, QColor("blue"),3, Qt::SolidLine, QColor(0,0,255,127));
//plotGeo->get_plotter()->addGraph(pie); //plotGeo->get_plotter()->addGraph(pie);
JKQTPgeoChord* chord=new JKQTPgeoChord(plotGeo->get_plotter(), 0,0,2,4,35, 98, QColor("blue"),3, Qt::SolidLine, QColor(0,0,255,127)); // JKQTPgeoChord* chord=new JKQTPgeoChord(plotGeo->get_plotter(), 0,0,2,4,35, 98, QColor("blue"),3, Qt::SolidLine, QColor(0,0,255,127));
//plotGeo->get_plotter()->addGraph(chord); //plotGeo->get_plotter()->addGraph(chord);
JKQTPgeoInfiniteLine* iline=new JKQTPgeoInfiniteLine(plotGeo->get_plotter(), 0.5,1,1,1, QColor("blue"), 3); JKQTPgeoInfiniteLine* iline=new JKQTPgeoInfiniteLine(plotGeo->get_plotter(), 0.5,1,1,1, QColor("blue"), 3);

View File

@ -95,7 +95,7 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
size_t cx2=ds->addColumn(x2, N2, "x2"); size_t cx2=ds->addColumn(x2, N2, "x2");
size_t cy21=ds->addColumn(y21, N2, "y21"); size_t cy21=ds->addColumn(y21, N2, "y21");
size_t cy22=ds->addColumn(y22, N2, "y22"); size_t cy22=ds->addColumn(y22, N2, "y22");
size_t cy23=ds->addColumn(y23, N2, "y23"); // size_t cy23=ds->addColumn(y23, N2, "y23");
//size_t cy24=ds->addColumn(y24, N2, "y24"); //size_t cy24=ds->addColumn(y24, N2, "y24");
size_t cx2r=ds->addColumn(x2r, N2, "x2r"); size_t cx2r=ds->addColumn(x2r, N2, "x2r");
size_t cy21r=ds->addColumn(y21r, N2, "y21r"); size_t cy21r=ds->addColumn(y21r, N2, "y21r");
@ -297,12 +297,12 @@ void TestWidgetGraphs::moveovl() {
} }
void TestWidgetGraphs::setErrorStyle(int index) void TestWidgetGraphs::setErrorStyle(int /*index*/)
{ {
QComboBox* cmb=qobject_cast<QComboBox*>(sender()); QComboBox* cmb=qobject_cast<QComboBox*>(sender());
if (cmb) { if (cmb) {
JKQTPxyGraphErrors* exy=dynamic_cast<JKQTPxyGraphErrors*>(plteErrors); JKQTPxyGraphErrors* exy=dynamic_cast<JKQTPxyGraphErrors*>(plteErrors);
JKQTPxGraphErrors* ex=dynamic_cast<JKQTPxGraphErrors*>(plteErrors); // JKQTPxGraphErrors* ex=dynamic_cast<JKQTPxGraphErrors*>(plteErrors);
JKQTPyGraphErrors* ey=dynamic_cast<JKQTPyGraphErrors*>(plteErrors); JKQTPyGraphErrors* ey=dynamic_cast<JKQTPyGraphErrors*>(plteErrors);
if (exy) { if (exy) {
exy->set_yErrorStyle(String2JKQTPerrorPlotstyle(cmb->itemData(cmb->currentIndex()).toString())); exy->set_yErrorStyle(String2JKQTPerrorPlotstyle(cmb->itemData(cmb->currentIndex()).toString()));
@ -314,7 +314,7 @@ void TestWidgetGraphs::setErrorStyle(int index)
} }
} }
void TestWidgetGraphs::setESSymbol(int index) void TestWidgetGraphs::setESSymbol(int /*index*/)
{ {
QComboBox* cmb=qobject_cast<QComboBox*>(sender()); QComboBox* cmb=qobject_cast<QComboBox*>(sender());
if (cmb) { if (cmb) {

View File

@ -33,6 +33,8 @@ CONFIG += qt
win32: LIBS += -lgdi32 win32: LIBS += -lgdi32
win32-msvc*: DEFINES += _USE_MATH_DEFINES
#QMAKE_CXXFLAGS += -O2 #QMAKE_CXXFLAGS += -O2
DEFINES -= -DQT_DLL DEFINES -= -DQT_DLL

View File

@ -15,6 +15,8 @@ INCLUDEPATH += ../../lib
CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib
CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib
win32-msvc*: DEFINES += _USE_MATH_DEFINES
# here you can activate some debug options # here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG #DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER #DEFINES += JKQTBP_AUTOTIMER

View File

@ -16,6 +16,8 @@ INCLUDEPATH += ../../lib
CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib
CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib
win32-msvc*: DEFINES += _USE_MATH_DEFINES
# here you can activate some debug options # here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG #DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER #DEFINES += JKQTBP_AUTOTIMER

View File

@ -1,6 +1,8 @@
#pragma once #pragma once
#include <array> #include <array>
#include <random> #include <random>
#include <chrono>
#include "jkqtplotter/jkqtplotter.h" #include "jkqtplotter/jkqtplotter.h"

View File

@ -16,6 +16,7 @@ INCLUDEPATH += ../../lib
CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib
CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib
win32-msvc*: DEFINES += _USE_MATH_DEFINES
# here you can activate some debug options # here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG #DEFINES += SHOW_JKQTPLOTTER_DEBUG

View File

@ -16,6 +16,7 @@ INCLUDEPATH += ../../lib
CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib
CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib
win32-msvc*: DEFINES += _USE_MATH_DEFINES
# here you can activate some debug options # here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG #DEFINES += SHOW_JKQTPLOTTER_DEBUG