From 48c376fe1b6750356d628345f2f7a274281156d6 Mon Sep 17 00:00:00 2001 From: jkriege2 Date: Sun, 16 Dec 2018 14:58:30 +0100 Subject: [PATCH] bugfix: symbol in key is drawn with anti-aliasing --- lib/jkqtplotter/jkqtpbaseplotter.cpp | 38 ++++++++++------------------ lib/jkqtplotter/jkqtpbaseplotter.h | 2 +- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/lib/jkqtplotter/jkqtpbaseplotter.cpp b/lib/jkqtplotter/jkqtpbaseplotter.cpp index ca9e169d91..bc4516ef08 100644 --- a/lib/jkqtplotter/jkqtpbaseplotter.cpp +++ b/lib/jkqtplotter/jkqtpbaseplotter.cpp @@ -1160,14 +1160,8 @@ void JKQtBasePlotter::paintPlot(JKQTPEnhancedPainter& painter, bool drawOverlays painter.fillRect(QRectF(iplotBorderLeft, iplotBorderTop, plotWidth, plotHeight), QBrush(plotBackgroundColor)); painter.restore(); painter.setRenderHint(JKQTPEnhancedPainter::NonCosmeticDefaultPen, true); - if (useAntiAliasingForSystem) - painter.setRenderHint(JKQTPEnhancedPainter::Antialiasing, true); - else - painter.setRenderHint(JKQTPEnhancedPainter::Antialiasing, false); - if (useAntiAliasingForText) - painter.setRenderHint(JKQTPEnhancedPainter::TextAntialiasing, true); - else - painter.setRenderHint(JKQTPEnhancedPainter::TextAntialiasing, false); + painter.setRenderHint(JKQTPEnhancedPainter::Antialiasing, useAntiAliasingForSystem); + painter.setRenderHint(JKQTPEnhancedPainter::TextAntialiasing, useAntiAliasingForText); plotSystemGrid(painter); if (!plotLabel.isEmpty()) { @@ -1181,34 +1175,28 @@ void JKQtBasePlotter::paintPlot(JKQTPEnhancedPainter& painter, bool drawOverlays mathText.draw(painter, iplotBorderLeft+(plotWidth-s.width())/2.0,plotBorderTop+a*1.2); } - if (useAntiAliasingForGraphs) - painter.setRenderHint(JKQTPEnhancedPainter::Antialiasing, true); - else - painter.setRenderHint(JKQTPEnhancedPainter::Antialiasing, false); + painter.setRenderHint(JKQTPEnhancedPainter::Antialiasing, useAntiAliasingForGraphs); + painter.setRenderHint(JKQTPEnhancedPainter::TextAntialiasing, useAntiAliasingForText); painter.save(); plotGraphs(painter); painter.restore(); - if (useAntiAliasingForSystem) - painter.setRenderHint(JKQTPEnhancedPainter::Antialiasing, true); - else - painter.setRenderHint(JKQTPEnhancedPainter::Antialiasing, false); - if (useAntiAliasingForText) - painter.setRenderHint(JKQTPEnhancedPainter::TextAntialiasing, true); - else - painter.setRenderHint(JKQTPEnhancedPainter::TextAntialiasing, false); + painter.setRenderHint(JKQTPEnhancedPainter::Antialiasing, useAntiAliasingForSystem); + painter.setRenderHint(JKQTPEnhancedPainter::TextAntialiasing, useAntiAliasingForText); + plotSystemXAxis(painter); plotSystemYAxis(painter); + painter.setRenderHint(JKQTPEnhancedPainter::Antialiasing, useAntiAliasingForGraphs); + painter.setRenderHint(JKQTPEnhancedPainter::TextAntialiasing, useAntiAliasingForText); if (showKey) plotKey(painter); + painter.setRenderHint(JKQTPEnhancedPainter::TextAntialiasing, useAntiAliasingForText); if (drawOverlays) plotOverlays(painter); //qDebug()<<" end JKQtPlotterBase::paintPlot"; } void JKQtBasePlotter::paintOverlays(JKQTPEnhancedPainter &painter) { painter.setRenderHint(JKQTPEnhancedPainter::NonCosmeticDefaultPen, true); - if (useAntiAliasingForGraphs) - painter.setRenderHint(JKQTPEnhancedPainter::Antialiasing, true); - else - painter.setRenderHint(JKQTPEnhancedPainter::Antialiasing, false); + painter.setRenderHint(JKQTPEnhancedPainter::Antialiasing, useAntiAliasingForGraphs); + painter.setRenderHint(JKQTPEnhancedPainter::TextAntialiasing, useAntiAliasingForText); painter.save(); plotOverlays(painter); painter.restore(); @@ -4249,7 +4237,7 @@ bool JKQtBasePlotter::containsGraph(JKQTPgraph* gr) const { }; -void JKQtBasePlotter::setGraphsDataRange(long long datarange_start, long long datarange_end) { +void JKQtBasePlotter::setGraphsDataRange(int datarange_start, int datarange_end) { for (int i=0; iset_datarange_start(datarange_start); graphs[i]->set_datarange_end(datarange_end); diff --git a/lib/jkqtplotter/jkqtpbaseplotter.h b/lib/jkqtplotter/jkqtpbaseplotter.h index 9b529a93ce..2218d04cc2 100644 --- a/lib/jkqtplotter/jkqtpbaseplotter.h +++ b/lib/jkqtplotter/jkqtpbaseplotter.h @@ -723,7 +723,7 @@ class LIB_EXPORT JKQtBasePlotter: public QObject { } /** \brief set the datarange of all current graphs to the given values */ - void setGraphsDataRange(long long datarange_start, long long datarange_end); + void setGraphsDataRange(int datarange_start, int datarange_end); void set_maintainAspectRatio(bool value) { maintainAspectRatio=value;