diff --git a/doc/dox/whatsnew.dox b/doc/dox/whatsnew.dox
index 8b73278180..3e4c7b0e99 100644
--- a/doc/dox/whatsnew.dox
+++ b/doc/dox/whatsnew.dox
@@ -43,6 +43,7 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
NEW: made resize-timer status accessible from outside via JKQTPlotter::isResizeTimerRunning()
NEW: made it's delay a global static variable that can be set and red with JKQTPlotter::setGlobalResizeDelay() and JKQTPlotter::getGlobalResizeDelay()
NEW: Using JKQTMathText::useGuiFonts() for FONT rendering by default
+ NEW: added the option to draw a character from a font as symbol (JKQTPCharacterSymbol+QChar('C').unicode()
)
JKQTMathText:
diff --git a/lib/jkqtcommon/jkqtpdrawingtools.cpp b/lib/jkqtcommon/jkqtpdrawingtools.cpp
index 1df972f90f..33c350a2c0 100644
--- a/lib/jkqtcommon/jkqtpdrawingtools.cpp
+++ b/lib/jkqtcommon/jkqtpdrawingtools.cpp
@@ -91,6 +91,13 @@ QString JKQTPGraphSymbols2String(JKQTPGraphSymbols pos) {
case JKQTPMale: return "symbol_male";
case JKQTPCirclePeace: return "symbol_circle_peace";
case JKQTPSymbolCount: JKQTPGraphSymbols2String(JKQTPMaxSymbolID);
+ case JKQTPCharacterSymbol:
+ break;
+ }
+ if (pos>=JKQTPCharacterSymbol && pos<=JKQTPCharacterSymbol+0xFF) {
+ QString s=QString::number(pos-JKQTPCharacterSymbol,16);
+ while (s.size()<4) s="0"+s;
+ return "symbol_char"+s;
}
return "";
}
@@ -162,11 +169,16 @@ QString JKQTPGraphSymbols2NameString(JKQTPGraphSymbols pos) {
case JKQTPMale: return QObject::tr("male");
case JKQTPCirclePeace: return QObject::tr("circled peace");
case JKQTPSymbolCount: JKQTPGraphSymbols2NameString(JKQTPMaxSymbolID);
+ case JKQTPCharacterSymbol: break;
+ }
+ if (pos>=JKQTPCharacterSymbol && pos<=JKQTPCharacterSymbol+0xFF) {
+ return QObject::tr("character")+" '"+QChar(static_cast(pos-JKQTPCharacterSymbol))+"'";
}
return "";
}
JKQTPGraphSymbols String2JKQTPGraphSymbols(const QString& pos) {
- QString s=pos.trimmed().toLower();
+ const QString posT=pos.trimmed();
+ const QString s=posT.toLower();
if (s=="symbol_dot"||s=="dot"||s==".") return JKQTPDot;
if (s=="symbol_cross"||s=="cross"||s=="x") return JKQTPCross;
if (s=="symbol_plus"||s=="plus"||s=="+") return JKQTPPlus;
@@ -230,7 +242,20 @@ JKQTPGraphSymbols String2JKQTPGraphSymbols(const QString& pos) {
if (s=="symbol_circle_peace" || s=="circle_peace") return JKQTPCirclePeace;
if (s=="symbol_female" || s=="female") return JKQTPFemale;
if (s=="symbol_male" || s=="male") return JKQTPMale;
-
+ if (posT.startsWith("symbol_charsym") && posT.size()>14) {
+ //qDebug()< "<7) {
+ //qDebug()< "<
#include
#include
+#include
#include "jkqtcommon/jkqtpmathtools.h"
#include "jkqtcommon/jkqtpcodestructuring.h"
@@ -60,7 +61,7 @@ struct JKQTPlotterDrawingTools {
/** \brief symbols that can be used to plot a datapoint for a graph
* \ingroup jkqtptools_drawing
*/
-enum JKQTPGraphSymbols {
+enum JKQTPGraphSymbols: uint64_t {
JKQTPNoSymbol=0, /*!< \brief plots no symbol at all (usefull together with error bars) */
JKQTPDot, /*!< \brief a small dot \image html symbols/symbol_dot.png */
JKQTPCross, /*!< \brief a X cross \image html symbols/symbol_cross.png */
@@ -136,8 +137,42 @@ enum JKQTPGraphSymbols {
JKQTPSymbolCount, /*!< \brief can be used to iterate over all symbols using: for (int i=0; i(JKQTPSymbolCount); i++) { JKQTPGraphSymbols s=static_cast(i); ... }
*/
JKQTPMaxSymbolID=JKQTPSymbolCount-1, /*!< \brief points to the last available symbol, can be used to iterate over all symbols: for (int i=0; i<=static_cast(JKQTPMaxSymbolID); i++) { JKQTPGraphSymbols s=static_cast(i); ... }
*/
JKQTPDefaultSymbol=JKQTPCross, /*!< \brief a default symbol used for plotting */
+
+ JKQTPCharacterSymbol=0x100, /*!< \brief you can use any character from a QFont by supplying \c JKQTPCharacterSymbol+QChar('').unicode() as JKQTPGraphSymbols \image html symbols/symbol_char_at.png "generated by JKQTPCharacterSymbol+QChar('@').unicode()" */
};
+inline JKQTPGraphSymbols operator+(JKQTPGraphSymbols a, uint8_t b) {
+ return static_cast(static_cast(a)+b);
+}
+
+inline JKQTPGraphSymbols operator+(JKQTPGraphSymbols a, uint16_t b) {
+ return static_cast(static_cast(a)+b);
+}
+
+inline JKQTPGraphSymbols operator+(JKQTPGraphSymbols a, uint32_t b) {
+ return static_cast(static_cast(a)+b);
+}
+
+inline JKQTPGraphSymbols operator+(JKQTPGraphSymbols a, uint64_t b) {
+ return static_cast(static_cast(a)+b);
+}
+
+inline JKQTPGraphSymbols operator+(JKQTPGraphSymbols a, int8_t b) {
+ return static_cast(static_cast(a)+b);
+}
+
+inline JKQTPGraphSymbols operator+(JKQTPGraphSymbols a, int16_t b) {
+ return static_cast(static_cast(a)+b);
+}
+
+inline JKQTPGraphSymbols operator+(JKQTPGraphSymbols a, int32_t b) {
+ return static_cast(static_cast(a)+b);
+}
+
+inline JKQTPGraphSymbols operator+(JKQTPGraphSymbols a, int64_t b) {
+ return static_cast(static_cast(a)+b);
+}
+
/** \brief converts a JKQTPGraphSymbols variable into a identifier string
* \ingroup jkqtptools_drawing
*/
@@ -243,9 +278,11 @@ JKQTCOMMON_LIB_EXPORT double JKQTPLineDecoratorStyleCalcDecoratorSize(double lin
\param symbolLineWidth width of the lines used to draw the symbol
\param color color of the symbol lines
\param fillColor color of the symbol filling
+ \param symbolFont font used to draw symbols like \c JKQTPCharacterSymbol+QChar('@').unicode()
+
*/
template
-inline void JKQTPPlotSymbol(TPainter& painter, double x, double y, JKQTPGraphSymbols symbol, double size, double symbolLineWidth, QColor color, QColor fillColor);
+inline void JKQTPPlotSymbol(TPainter& painter, double x, double y, JKQTPGraphSymbols symbol, double size, double symbolLineWidth, QColor color, QColor fillColor, QFont symbolFont);
/*! \brief plot the specified symbol at pixel position x,y
\ingroup jkqtptools_drawing
@@ -258,8 +295,10 @@ inline void JKQTPPlotSymbol(TPainter& painter, double x, double y, JKQTPGraphSym
\param symbolLineWidth width of the lines used to draw the symbol
\param color color of the symbol lines
\param fillColor color of the symbol filling
+ \param symbolFont font used to draw symbols like \c JKQTPCharacterSymbol+QChar('@').unicode()
+
*/
-JKQTCOMMON_LIB_EXPORT void JKQTPPlotSymbol(QPaintDevice& paintDevice, double x, double y, JKQTPGraphSymbols symbol, double size, double symbolLineWidth, QColor color, QColor fillColor);
+JKQTCOMMON_LIB_EXPORT void JKQTPPlotSymbol(QPaintDevice& paintDevice, double x, double y, JKQTPGraphSymbols symbol, double size, double symbolLineWidth, QColor color, QColor fillColor, const QFont &symbolFont);
@@ -443,7 +482,7 @@ inline void JKQTPDrawTooltip(TPainter& painter, double x, double y, const QRectF
template
-inline void JKQTPPlotSymbol(TPainter& painter, double x, double y, JKQTPGraphSymbols symbol, double symbolSize, double symbolLineWidth, QColor color, QColor fillColor) {
+inline void JKQTPPlotSymbol(TPainter& painter, double x, double y, JKQTPGraphSymbols symbol, double symbolSize, double symbolLineWidth, QColor color, QColor fillColor, QFont symbolFont) {
if (symbol==JKQTPNoSymbol) return;
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
QPen p=painter.pen();
@@ -810,8 +849,31 @@ inline void JKQTPPlotSymbol(TPainter& painter, double x, double y, JKQTPGraphSym
case JKQTPNoSymbol:
case JKQTPSymbolCount:
+ case JKQTPCharacterSymbol:
break;
}
+ if (symbol>=JKQTPCharacterSymbol && symbol<=JKQTPCharacterSymbol+0xFFFF) {
+ symbolFont.setStyleStrategy(QFont::PreferDefault);
+ const QChar ch(static_cast(symbol-JKQTPCharacterSymbol));
+ const QFontMetricsF fm(symbolFont);
+ const QRectF tbr=fm.tightBoundingRect(ch);
+ const double scale=symbolSize/qMax(tbr.width(), tbr.height());
+ painter.translate(QPointF(x,y));
+ //painter.setPen(QColor("yellow"));
+ //painter.drawEllipse(QPointF(0,0),symbolSize/2.0,symbolSize/2.0);
+ painter.scale(scale,scale);
+ //painter.setPen(QColor("green"));
+ //painter.drawRect(tbr);
+ //painter.drawEllipse(QPointF(0,0),2,2);
+ painter.translate(-tbr.center());//QPointF(-tbr.width()/2.0,-tbr.height()/2.0)+QPointF(tbr.x(),tbr.y()));
+ //painter.setPen(QColor("red"));
+ //painter.drawRect(tbr);
+ //painter.drawEllipse(QPointF(0,0),2,2);
+ painter.setBrush(QColor(Qt::transparent));
+ painter.setPen(pDescaled.color());
+ painter.setFont(symbolFont);
+ painter.drawText(0.0,0.0,ch);
+ }
}
diff --git a/lib/jkqtcommon/jkqtpicons.cpp b/lib/jkqtcommon/jkqtpicons.cpp
index 074951e01f..325e7af948 100644
--- a/lib/jkqtcommon/jkqtpicons.cpp
+++ b/lib/jkqtcommon/jkqtpicons.cpp
@@ -104,7 +104,7 @@ QIcon JKQTPGraphSymbols2Icon(JKQTPGraphSymbols style)
p.setRenderHint(QPainter::Antialiasing);
p.setRenderHint(QPainter::TextAntialiasing);
p.setPen(QPen(QColor(Qt::black), 1, Qt::SolidLine));
- JKQTPPlotSymbol(p, icon.width()/2, icon.height()/2, style, 15, 1, QColor("black"), QColor("silver"));
+ JKQTPPlotSymbol(p, icon.width()/2, icon.height()/2, style, 15, 1, QColor("black"), QColor("silver"),QGuiApplication::font().family());
p.end();
}
diff --git a/lib/jkqtplotter/graphs/jkqtpboxplotstylingmixins.cpp b/lib/jkqtplotter/graphs/jkqtpboxplotstylingmixins.cpp
index 80431b612a..1c15f3c04f 100644
--- a/lib/jkqtplotter/graphs/jkqtpboxplotstylingmixins.cpp
+++ b/lib/jkqtplotter/graphs/jkqtpboxplotstylingmixins.cpp
@@ -47,6 +47,7 @@ JKQTPGraphBoxplotStyleMixin::JKQTPGraphBoxplotStyleMixin()
m_meanSymbolType=JKQTPGraphSymbols::JKQTPDefaultSymbol;
m_meanSymbolSize=12;
m_meanSymbolFillColor=m_meanSymbolLinePen.color().lighter();
+ m_meanSymbolFontName=QGuiApplication::font().family();
boxWidthAbsolute=m_meanSymbolSize*3.0;
@@ -80,6 +81,7 @@ void JKQTPGraphBoxplotStyleMixin::initBoxplotStyle(JKQTBasePlotter *parent, int
m_meanSymbolLineWidth=pen.symbolLineWidthF();
m_meanSymbolType=pen.symbol();
m_meanSymbolFillColor=pen.symbolFillColor();
+ m_meanSymbolFontName=parent->getDefaultTextFontName();
}
setWhiskerLineColor(getLineColor());
@@ -218,6 +220,23 @@ double JKQTPGraphBoxplotStyleMixin::getMeanLineWidth() const
return m_meanSymbolLineWidth;
}
+void JKQTPGraphBoxplotStyleMixin::setMeanSymbolFontName(const QString &__value)
+{
+ m_meanSymbolFontName=__value;
+}
+
+QString JKQTPGraphBoxplotStyleMixin::getMeanSymbolFontName() const
+{
+ return m_meanSymbolFontName;
+}
+
+QFont JKQTPGraphBoxplotStyleMixin::getMeanSymbolFont() const
+{
+ QFont f(m_meanSymbolFontName, m_meanSymbolSize);
+ f.setStyleStrategy(QFont::PreferDefault);
+ return f;
+}
+
void JKQTPGraphBoxplotStyleMixin::setMeanLineStyle(Qt::PenStyle __value)
{
@@ -563,7 +582,7 @@ QBrush JKQTPGraphBoxplotStyleMixin::getMeanSymbolBrush(JKQTPEnhancedPainter& /*p
void JKQTPGraphBoxplotStyleMixin::plotStyledMeanSymbol(JKQTBasePlotter *parent, JKQTPEnhancedPainter &painter, double x, double y) const
{
- JKQTPPlotSymbol(painter, x, y,m_meanSymbolType, parent->pt2px(painter, m_meanSymbolSize), parent->pt2px(painter, m_meanSymbolLineWidth*parent->getLineWidthMultiplier()), m_meanSymbolLinePen.color(), m_meanSymbolFillColor);
+ JKQTPPlotSymbol(painter, x, y,m_meanSymbolType, parent->pt2px(painter, m_meanSymbolSize), parent->pt2px(painter, m_meanSymbolLineWidth*parent->getLineWidthMultiplier()), m_meanSymbolLinePen.color(), m_meanSymbolFillColor, getMeanSymbolFont());
}
diff --git a/lib/jkqtplotter/graphs/jkqtpboxplotstylingmixins.h b/lib/jkqtplotter/graphs/jkqtpboxplotstylingmixins.h
index bfeddff936..a2da61f95f 100644
--- a/lib/jkqtplotter/graphs/jkqtpboxplotstylingmixins.h
+++ b/lib/jkqtplotter/graphs/jkqtpboxplotstylingmixins.h
@@ -318,6 +318,13 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGraphBoxplotStyleMixin: public JKQTPGraphLineS
void setMeanLineWidth(double __value);
/** \brief get the line width of the symbol for the mean outline, or mean line (in pt) */
double getMeanLineWidth() const;
+ /** \brief set the font to be used for mean character symbols \c JKQTPCharacterSymbol+QChar('').unicode() */
+ void setMeanSymbolFontName(const QString& __value);
+ /** \brief get the font to be used for mean character symbols \c JKQTPCharacterSymbol+QChar('').unicode() */
+ QString getMeanSymbolFontName() const;
+
+ /** \brief generate a QFont for darwing symbols */
+ QFont getMeanSymbolFont() const;
/** \brief constructs a QPen from the line styling properties to draw the mean line */
QPen getMeanLinePen(JKQTPEnhancedPainter &painter, JKQTBasePlotter* parent) const;
@@ -398,6 +405,8 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGraphBoxplotStyleMixin: public JKQTPGraphLineS
QColor m_meanSymbolFillColor;
/** \brief width (in pt) of the lines used to plot the symbol for the data points, given in pt */
double m_meanSymbolLineWidth;
+ /** \brief font to be used for character mean symbols \c JKQTPCharacterSymbol+QChar('').unicode() */
+ QString m_meanSymbolFontName;
/** \brief line style of the whisker lines */
QPen m_whiskerLinePen;
/** \brief line width (in pt) of the whisker lines */
diff --git a/lib/jkqtplotter/graphs/jkqtpevaluatedfunctionbase.cpp b/lib/jkqtplotter/graphs/jkqtpevaluatedfunctionbase.cpp
index 43c561fcf5..eb741c38f7 100644
--- a/lib/jkqtplotter/graphs/jkqtpevaluatedfunctionbase.cpp
+++ b/lib/jkqtplotter/graphs/jkqtpevaluatedfunctionbase.cpp
@@ -66,7 +66,7 @@ void JKQTPEvaluatedFunctionGraphBase::drawSamplePoints(JKQTPEnhancedPainter& pai
painter.save(); auto __finalpaintsamplepoints=JKQTPFinally([&painter]() {painter.restore();});
for (const auto& d: data) {
if (JKQTPIsOKFloat(d.x()) && JKQTPIsOKFloat(d.y())) {
- JKQTPPlotSymbol(painter, d.x(), d.y(), JKQTPCross, 6,1*parent->getLineWidthMultiplier(), c, QColor(Qt::transparent));
+ JKQTPPlotSymbol(painter, d.x(), d.y(), JKQTPCross, 6,1*parent->getLineWidthMultiplier(), c, QColor(Qt::transparent), QGuiApplication::font().family());
}
}
}
diff --git a/lib/jkqtplotter/graphs/jkqtpgeoannotations.cpp b/lib/jkqtplotter/graphs/jkqtpgeoannotations.cpp
index ec8c019d8f..a0c33b3065 100644
--- a/lib/jkqtplotter/graphs/jkqtpgeoannotations.cpp
+++ b/lib/jkqtplotter/graphs/jkqtpgeoannotations.cpp
@@ -284,7 +284,7 @@ void JKQTPGeoSymbol::draw(JKQTPEnhancedPainter &painter)
void JKQTPGeoSymbol::drawKeyMarker(JKQTPEnhancedPainter &painter, QRectF &rect)
{
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
- JKQTPPlotSymbol(painter, rect.left()+rect.width()/2.0, rect.top()+rect.height()/2.0, getSymbolType(), getKeySymbolSizePx(painter, rect, parent), getKeySymbolLineWidthPx(painter, rect, parent), getKeyLabelColor(), getSymbolFillColor());
+ JKQTPPlotSymbol(painter, rect.left()+rect.width()/2.0, rect.top()+rect.height()/2.0, getSymbolType(), getKeySymbolSizePx(painter, rect, parent), getKeySymbolLineWidthPx(painter, rect, parent), getKeyLabelColor(), getSymbolFillColor(),getSymbolFont());
}
QColor JKQTPGeoSymbol::getKeyLabelColor() const
diff --git a/lib/jkqtplotter/graphs/jkqtpgeolines.cpp b/lib/jkqtplotter/graphs/jkqtpgeolines.cpp
index bfda70af91..47c6ea9c18 100644
--- a/lib/jkqtplotter/graphs/jkqtpgeolines.cpp
+++ b/lib/jkqtplotter/graphs/jkqtpgeolines.cpp
@@ -143,9 +143,6 @@ void JKQTPGeoLine::draw(JKQTPEnhancedPainter& painter) {
//points[0]=lx1;
//points[points.size()-1]=lx2;
painter.drawPolylineFast(points.data(), points.size());
- /*for (auto& p: points) {
- JKQTPPlotSymbol(painter, p.x(), p.y(), JKQTPPlus, 5, 1, QColor("green"), QColor("darkgreen"));
- }*/
}
}
}
@@ -422,9 +419,6 @@ void JKQTPGeoInfiniteLine::draw(JKQTPEnhancedPainter& painter) {
const QPointF xx1p=points[1];
angle1=atan2(xx1p.y()-xx1.y(), xx1p.x()-xx1.x());
painter.drawPolylineFast(points.data(), points.size());
- /*for (auto& p: points) {
- JKQTPPlotSymbol(painter, p.x(), p.y(), JKQTPPlus, 5, 1, QColor("green"), QColor("darkgreen"));
- }*/
}
}
@@ -609,9 +603,6 @@ void JKQTPGeoPolyLines::draw(JKQTPEnhancedPainter& painter) {
angle2=atan2(xx2p.y()-xx2.y(), xx2p.x()-xx2.x());
painter.drawPolylineFast(points_poly.data(), points_poly.size());
doDrawDecorator=true;
- /*for (auto& p: points_poly) {
- JKQTPPlotSymbol(painter, p.x(), p.y(), JKQTPPlus, 5, 1, QColor("green"), QColor("darkgreen"));
- }*/
}
}
diff --git a/lib/jkqtplotter/graphs/jkqtpimageoverlays.cpp b/lib/jkqtplotter/graphs/jkqtpimageoverlays.cpp
index 8984a6bef0..e06a1567d6 100644
--- a/lib/jkqtplotter/graphs/jkqtpimageoverlays.cpp
+++ b/lib/jkqtplotter/graphs/jkqtpimageoverlays.cpp
@@ -207,6 +207,8 @@ JKQTPOverlayImageEnhanced::JKQTPOverlayImageEnhanced(double x, double y, double
symbolLineWidth=1;
drawMode=OverlayImageEnhancedDrawMode::DrawAsRectangles;
symbolSizeFactor=0.9;
+ m_symbolFontName=parent->getDefaultTextFontName();
+
}
JKQTPOverlayImageEnhanced::JKQTPOverlayImageEnhanced(JKQTBasePlotter *parent):
@@ -216,6 +218,8 @@ JKQTPOverlayImageEnhanced::JKQTPOverlayImageEnhanced(JKQTBasePlotter *parent):
symbolLineWidth=1;
drawMode=OverlayImageEnhancedDrawMode::DrawAsRectangles;
symbolSizeFactor=0.9;
+ m_symbolFontName=parent->getDefaultTextFontName();
+
}
JKQTPOverlayImageEnhanced::JKQTPOverlayImageEnhanced(double x, double y, double width, double height, bool* data, int Nx, int Ny, QColor colTrue, JKQTPlotter* parent):
@@ -225,6 +229,8 @@ JKQTPOverlayImageEnhanced::JKQTPOverlayImageEnhanced(double x, double y, double
symbolLineWidth=1;
drawMode=OverlayImageEnhancedDrawMode::DrawAsRectangles;
symbolSizeFactor=0.9;
+ m_symbolFontName=parent->getPlotter()->getDefaultTextFontName();
+
}
JKQTPOverlayImageEnhanced::JKQTPOverlayImageEnhanced(JKQTPlotter *parent):
@@ -234,11 +240,13 @@ JKQTPOverlayImageEnhanced::JKQTPOverlayImageEnhanced(JKQTPlotter *parent):
symbolLineWidth=1;
drawMode=OverlayImageEnhancedDrawMode::DrawAsRectangles ;
symbolSizeFactor=0.9;
+ m_symbolFontName=parent->getPlotter()->getDefaultTextFontName();
+
}
void JKQTPOverlayImageEnhanced::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
if (drawMode!=OverlayImageEnhancedDrawMode::DrawAsSymbols) JKQTPOverlayImage::drawKeyMarker(painter, rect);
- else JKQTPPlotSymbol(painter, rect.center().x(), rect.center().y(), symbol, qMin(rect.width(), rect.height()), parent->pt2px(painter, symbolLineWidth*parent->getLineWidthMultiplier()), trueColor, trueColor.lighter());
+ else JKQTPPlotSymbol(painter, rect.center().x(), rect.center().y(), symbol, qMin(rect.width(), rect.height()), parent->pt2px(painter, symbolLineWidth*parent->getLineWidthMultiplier()), trueColor, trueColor.lighter(), m_symbolFontName);
}
void JKQTPOverlayImageEnhanced::setSymbolType(JKQTPGraphSymbols __value)
@@ -251,6 +259,17 @@ JKQTPGraphSymbols JKQTPOverlayImageEnhanced::getSymbol() const
return this->symbol;
}
+
+void JKQTPOverlayImageEnhanced::setSymbolFontName(const QString& __value)
+{
+ this->m_symbolFontName = __value;
+}
+
+QString JKQTPOverlayImageEnhanced::getSymbolFontName() const
+{
+ return this->m_symbolFontName;
+}
+
void JKQTPOverlayImageEnhanced::setSymbolLineWidth(double __value)
{
this->symbolLineWidth = __value;
@@ -314,7 +333,7 @@ void JKQTPOverlayImageEnhanced::draw(JKQTPEnhancedPainter& painter) {
} else if (drawMode==DrawAsSymbols){
QPointF p=(p1+p2)/2.0;
if (data[ix+iy*Nx]) {
- JKQTPPlotSymbol(painter, p.x(), p.y(), symbol, fabs(p2.x()-p1.x())*symbolSizeFactor, parent->pt2px(painter, symbolLineWidth*parent->getLineWidthMultiplier()), trueColor, trueColor.lighter());
+ JKQTPPlotSymbol(painter, p.x(), p.y(), symbol, fabs(p2.x()-p1.x())*symbolSizeFactor, parent->pt2px(painter, symbolLineWidth*parent->getLineWidthMultiplier()), trueColor, trueColor.lighter(),QFont(m_symbolFontName,10));
}
}
}
diff --git a/lib/jkqtplotter/graphs/jkqtpimageoverlays.h b/lib/jkqtplotter/graphs/jkqtpimageoverlays.h
index 5a1eb12eef..adddb924cc 100644
--- a/lib/jkqtplotter/graphs/jkqtpimageoverlays.h
+++ b/lib/jkqtplotter/graphs/jkqtpimageoverlays.h
@@ -173,6 +173,10 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPOverlayImageEnhanced: public JKQTPOverlayImage
void setSymbolSizeFactor(double __value);
/** \copydoc symbolSizeFactor */
double getSymbolSizeFactor() const;
+ /** \brief set the font to be used for character symbols \c JKQTPCharacterSymbol+QChar('').unicode() */
+ void setSymbolFontName(const QString& __value);
+ /** \brief get the font to be used for character symbols \c JKQTPCharacterSymbol+QChar('').unicode() */
+ QString getSymbolFontName() const;
protected:
/** \brief which symbol to use for the datapoints */
@@ -185,6 +189,8 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPOverlayImageEnhanced: public JKQTPOverlayImage
/** \brief a rescaling factor for the symbols */
double symbolSizeFactor;
+ /** \brief font to be used for character symbols \c JKQTPCharacterSymbol+QChar('').unicode() */
+ QString m_symbolFontName;
};
diff --git a/lib/jkqtplotter/graphs/jkqtplines.cpp b/lib/jkqtplotter/graphs/jkqtplines.cpp
index b245762d62..5ee2f47db2 100644
--- a/lib/jkqtplotter/graphs/jkqtplines.cpp
+++ b/lib/jkqtplotter/graphs/jkqtplines.cpp
@@ -104,7 +104,7 @@ void JKQTPXYLineGraph::draw(JKQTPEnhancedPainter& painter) {
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv) && JKQTPIsOKFloat(x) && JKQTPIsOKFloat(y)) {
//if (isHighlighted() && getSymbolType()!=JKQTPNoSymbol) {
- //JKQTPPlotSymbol(painter, x, y, JKQTPFilledCircle, parent->pt2px(painter, symbolSize*1.5), parent->pt2px(painter, symbolWidth*parent->getLineWidthMultiplier()), penSelection.color(), penSelection.color());
+ //JKQTPPlotSymbol(painter, x, y, JKQTPFilledCircle, parent->pt2px(painter, symbolSize*1.5), parent->pt2px(painter, symbolWidth*parent->getLineWidthMultiplier()), penSelection.color(), penSelection.color(),getSymbolFont());
//}
if ((!parent->getXAxis()->isLogAxis() || xv>0.0) && (!parent->getYAxis()->isLogAxis() || yv>0.0) ) {
if (symType!=JKQTPNoSymbol && cliprect.contains(x,y)) plotStyledSymbol(parent, painter, x, y);
@@ -156,7 +156,7 @@ void JKQTPXYLineGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect
painter.setPen(p);
double y=rect.top()+rect.height()/2.0;
if (drawLine) painter.drawLine(QLineF(rect.left(), y, rect.right(), y));
- JKQTPPlotSymbol(painter, rect.left()+rect.width()/2.0, rect.top()+rect.height()/2.0, getSymbolType(), getKeySymbolSizePx(painter, rect, parent), getKeySymbolLineWidthPx(painter, rect, parent), getKeyLabelColor(), getSymbolFillColor());
+ JKQTPPlotSymbol(painter, rect.left()+rect.width()/2.0, rect.top()+rect.height()/2.0, getSymbolType(), getKeySymbolSizePx(painter, rect, parent), getKeySymbolLineWidthPx(painter, rect, parent), getKeyLabelColor(), getSymbolFillColor(),getSymbolFont());
}
QColor JKQTPXYLineGraph::getKeyLabelColor() const {
diff --git a/lib/jkqtplotter/graphs/jkqtpscatter.cpp b/lib/jkqtplotter/graphs/jkqtpscatter.cpp
index 93179d439d..403af5e466 100644
--- a/lib/jkqtplotter/graphs/jkqtpscatter.cpp
+++ b/lib/jkqtplotter/graphs/jkqtpscatter.cpp
@@ -117,7 +117,7 @@ void JKQTPXYScatterGraph::draw(JKQTPEnhancedPainter& painter) {
void JKQTPXYScatterGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
- JKQTPPlotSymbol(painter, rect.left()+rect.width()/2.0, rect.top()+rect.height()/2.0, getSymbolType(), getKeySymbolSizePx(painter, rect, parent), getKeySymbolLineWidthPx(painter, rect, parent), getKeyLabelColor(), getSymbolFillColor());
+ JKQTPPlotSymbol(painter, rect.left()+rect.width()/2.0, rect.top()+rect.height()/2.0, getSymbolType(), getKeySymbolSizePx(painter, rect, parent), getKeySymbolLineWidthPx(painter, rect, parent), getKeyLabelColor(), getSymbolFillColor(),getSymbolFont());
}
QColor JKQTPXYScatterGraph::getKeyLabelColor() const {
@@ -364,9 +364,9 @@ void JKQTPXYParametrizedScatterGraph::draw(JKQTPEnhancedPainter &painter)
if ((!parent->getXAxis()->isLogAxis() || xv>0.0) && (!parent->getYAxis()->isLogAxis() || yv>0.0) ) {
if (isHighlighted() && getSymbolType()!=JKQTPNoSymbol && symbolColumn<0) {
- JKQTPPlotSymbol(painter, x, y, JKQTPFilledCircle,symbSize, parent->pt2px(painter, getSymbolLineWidth()*parent->getLineWidthMultiplier()), penSelection.color(), penSelection.color());
+ JKQTPPlotSymbol(painter, x, y, JKQTPFilledCircle,symbSize, parent->pt2px(painter, getSymbolLineWidth()*parent->getLineWidthMultiplier()), penSelection.color(), penSelection.color(),getSymbolFont());
} else {
- JKQTPPlotSymbol(painter, x, y, getLocalSymbolType(i), symbSize, parent->pt2px(painter, getSymbolLineWidth()*parent->getLineWidthMultiplier()), symbColor, symbFillColor);
+ JKQTPPlotSymbol(painter, x, y, getLocalSymbolType(i), symbSize, parent->pt2px(painter, getSymbolLineWidth()*parent->getLineWidthMultiplier()), symbColor, symbFillColor,getSymbolFont());
}
}
@@ -461,8 +461,8 @@ void JKQTPXYParametrizedScatterGraph::drawKeyMarker(JKQTPEnhancedPainter &painte
const double y1=rect.top()+symbolSize1/2.0;
const double x2=rect.right()-symbolSize2/2.0;
const double y2=rect.bottom()-symbolSize2/2.0;
- JKQTPPlotSymbol(painter, x1, y1, symbol1, symbolSize1, getKeySymbolLineWidthPx(painter, rect, parent,0.5), color1, JKQTPGetDerivedColor(symbolFillDerivationMode, color1));
- JKQTPPlotSymbol(painter, x2, y2, symbol2, symbolSize2, getKeySymbolLineWidthPx(painter, rect, parent,0.5), color2, JKQTPGetDerivedColor(symbolFillDerivationMode, color2));
+ JKQTPPlotSymbol(painter, x1, y1, symbol1, symbolSize1, getKeySymbolLineWidthPx(painter, rect, parent,0.5), color1, JKQTPGetDerivedColor(symbolFillDerivationMode, color1),getSymbolFont());
+ JKQTPPlotSymbol(painter, x2, y2, symbol2, symbolSize2, getKeySymbolLineWidthPx(painter, rect, parent,0.5), color2, JKQTPGetDerivedColor(symbolFillDerivationMode, color2),getSymbolFont());
if (drawLine) painter.drawLine(QLineF(x1,y1, x2,y2));
}
diff --git a/lib/jkqtplotter/graphs/jkqtpsinglecolumnsymbols.cpp b/lib/jkqtplotter/graphs/jkqtpsinglecolumnsymbols.cpp
index 7dfa8e081b..652bc2ebc4 100644
--- a/lib/jkqtplotter/graphs/jkqtpsinglecolumnsymbols.cpp
+++ b/lib/jkqtplotter/graphs/jkqtpsinglecolumnsymbols.cpp
@@ -232,7 +232,7 @@ void JKQTPSingleColumnSymbolsGraph::drawKeyMarker(JKQTPEnhancedPainter &painter,
QPen p=getSymbolPen(painter, parent);
painter.setPen(p);
if (positionScatterStyle!=RugPlot) {
- JKQTPPlotSymbol(painter, rect.left()+rect.width()/2.0, rect.top()+rect.height()/2.0, getSymbolType(), symbolSize, symbolWidth, getKeyLabelColor(), getSymbolFillColor());
+ JKQTPPlotSymbol(painter, rect.left()+rect.width()/2.0, rect.top()+rect.height()/2.0, getSymbolType(), symbolSize, symbolWidth, getKeyLabelColor(), getSymbolFillColor(),getSymbolFont());
} else {
painter.translate(rect.center());
if (dataDirection==DataDirection::X) {
diff --git a/lib/jkqtplotter/graphs/jkqtpspecialline.cpp b/lib/jkqtplotter/graphs/jkqtpspecialline.cpp
index e3d2a80760..23feec6bf6 100644
--- a/lib/jkqtplotter/graphs/jkqtpspecialline.cpp
+++ b/lib/jkqtplotter/graphs/jkqtpspecialline.cpp
@@ -56,7 +56,7 @@ void JKQTPSpecialLineGraphBase::drawKeyMarker(JKQTPEnhancedPainter& painter, QRe
if (getFillCurve()) painter.drawRect(rect);
if (!getFillCurve() && getDrawLine()) painter.drawLine(QLineF(rect.left(), y, rect.right(), y));
if (m_drawSymbols) {
- JKQTPPlotSymbol(painter, rect.center().x(), rect.center().y(), getSymbolType(), getKeySymbolSizePx(painter, rect, parent), getKeySymbolLineWidthPx(painter, rect, parent), getKeyLabelColor(), getSymbolFillColor());
+ JKQTPPlotSymbol(painter, rect.center().x(), rect.center().y(), getSymbolType(), getKeySymbolSizePx(painter, rect, parent), getKeySymbolLineWidthPx(painter, rect, parent), getKeyLabelColor(), getSymbolFillColor(),getSymbolFont());
}
}
diff --git a/lib/jkqtplotter/graphs/jkqtpviolinplotstylingmixins.cpp b/lib/jkqtplotter/graphs/jkqtpviolinplotstylingmixins.cpp
index fba79400d4..521602f064 100644
--- a/lib/jkqtplotter/graphs/jkqtpviolinplotstylingmixins.cpp
+++ b/lib/jkqtplotter/graphs/jkqtpviolinplotstylingmixins.cpp
@@ -46,6 +46,7 @@ JKQTPGraphViolinplotStyleMixin::JKQTPGraphViolinplotStyleMixin()
m_meanSymbolType=JKQTPGraphSymbols::JKQTPDefaultSymbol;
m_meanSymbolSize=12;
m_meanSymbolFillColor=m_meanSymbolLinePen.color().lighter();
+ m_meanSymbolFontName=QGuiApplication::font().family();
violinWidthAbsolute=m_meanSymbolSize*6.0;
@@ -78,6 +79,7 @@ void JKQTPGraphViolinplotStyleMixin::initViolinplotStyle(JKQTBasePlotter *parent
m_meanSymbolLineWidth=pen.symbolLineWidthF();
m_meanSymbolType=pen.symbol();
m_meanSymbolFillColor=pen.symbolFillColor();
+ m_meanSymbolFontName=parent->getDefaultTextFontName();
}
setWhiskerLineColor(getLineColor());
@@ -147,6 +149,16 @@ JKQTPGraphSymbols JKQTPGraphViolinplotStyleMixin::getMeanSymbolType() const
return m_meanSymbolType;
}
+void JKQTPGraphViolinplotStyleMixin::setMeanSymbolFontName(const QString &__value)
+{
+ m_meanSymbolFontName=__value;
+}
+
+QString JKQTPGraphViolinplotStyleMixin::getMeanSymbolFontName() const
+{
+ return m_meanSymbolFontName;
+}
+
void JKQTPGraphViolinplotStyleMixin::setMeanSize(double __value)
{
m_meanSymbolSize=__value;
@@ -187,6 +199,13 @@ double JKQTPGraphViolinplotStyleMixin::getMeanLineWidth() const
return m_meanSymbolLineWidth;
}
+QFont JKQTPGraphViolinplotStyleMixin::getMeanSymbolFont() const
+{
+ QFont f(m_meanSymbolFontName, m_meanSymbolSize);
+ f.setStyleStrategy(QFont::PreferDefault);
+ return f;
+}
+
JKQTPGraphViolinplotStyleMixin::ViolinStyle JKQTPGraphViolinplotStyleMixin::getViolinStyle() const
{
return m_violinStyle;
@@ -552,7 +571,7 @@ QBrush JKQTPGraphViolinplotStyleMixin::getMeanSymbolBrush(JKQTPEnhancedPainter&
void JKQTPGraphViolinplotStyleMixin::plotStyledMeanSymbol(JKQTBasePlotter *parent, JKQTPEnhancedPainter &painter, double x, double y) const
{
- JKQTPPlotSymbol(painter, x, y,m_meanSymbolType, parent->pt2px(painter, m_meanSymbolSize), parent->pt2px(painter, m_meanSymbolLineWidth*parent->getLineWidthMultiplier()), m_meanSymbolLinePen.color(), m_meanSymbolFillColor);
+ JKQTPPlotSymbol(painter, x, y,m_meanSymbolType, parent->pt2px(painter, m_meanSymbolSize), parent->pt2px(painter, m_meanSymbolLineWidth*parent->getLineWidthMultiplier()), m_meanSymbolLinePen.color(), m_meanSymbolFillColor, getMeanSymbolFont());
}
diff --git a/lib/jkqtplotter/graphs/jkqtpviolinplotstylingmixins.h b/lib/jkqtplotter/graphs/jkqtpviolinplotstylingmixins.h
index 5dff0ac80b..92e7e8fc02 100644
--- a/lib/jkqtplotter/graphs/jkqtpviolinplotstylingmixins.h
+++ b/lib/jkqtplotter/graphs/jkqtpviolinplotstylingmixins.h
@@ -274,6 +274,10 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGraphViolinplotStyleMixin: public JKQTPGraphLi
void setMeanSymbolType(JKQTPGraphSymbols __value);
/** \brief get the type of the symbol for the mean */
JKQTPGraphSymbols getMeanSymbolType() const;
+ /** \brief set the font to be used for mean character symbols \c JKQTPCharacterSymbol+QChar('').unicode() */
+ void setMeanSymbolFontName(const QString& __value);
+ /** \brief get the font to be used for mean character symbols \c JKQTPCharacterSymbol+QChar('').unicode() */
+ QString getMeanSymbolFontName() const;
/** \brief set the size (=diameter in pt) of the symbol for the mean (in pt) */
void setMeanSize(double __value);
@@ -336,6 +340,8 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGraphViolinplotStyleMixin: public JKQTPGraphLi
/** \brief set the color of the graph (colors all elements, based on the given color \a c , sets background colors from \a bc ) */
void setViolinplotColor(QColor c, QColor bc, JKQTBasePlotter *parent);
+ /** \brief generate a QFont for darwing symbols */
+ QFont getMeanSymbolFont() const;
protected:
/*! \brief plot a symbol at location x,y (in painter coordinates), using the current style
@@ -397,6 +403,9 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGraphViolinplotStyleMixin: public JKQTPGraphLi
QColor m_meanSymbolFillColor;
/** \brief width (in pt) of the lines used to plot the symbol for the data points, given in pt */
double m_meanSymbolLineWidth;
+ /** \brief font to be used for character mean symbols \c JKQTPCharacterSymbol+QChar('').unicode() */
+ QString m_meanSymbolFontName;
+
/** \brief line style of the whisker lines */
QPen m_whiskerLinePen;
/** \brief line width (in pt) of the whisker lines */
diff --git a/lib/jkqtplotter/gui/jkqtpcomboboxes.cpp b/lib/jkqtplotter/gui/jkqtpcomboboxes.cpp
index b67dd4f24b..9347edfdf4 100644
--- a/lib/jkqtplotter/gui/jkqtpcomboboxes.cpp
+++ b/lib/jkqtplotter/gui/jkqtpcomboboxes.cpp
@@ -110,7 +110,7 @@ void JKQTPSymbolComboBox::addSymbol(JKQTPGraphSymbols symbol, const QString &nam
p.begin(&pix);
p.setRenderHint(JKQTPEnhancedPainter::Antialiasing);
p.setRenderHint(JKQTPEnhancedPainter::TextAntialiasing);
- JKQTPPlotSymbol(p, 6.0*dpr,6.0*dpr,symbol,10.0*dpr,1,QColor("blue"), QColor("blue").lighter());
+ JKQTPPlotSymbol(p, 6.0*dpr,6.0*dpr,symbol,10.0*dpr,1,QColor("blue"), QColor("blue").lighter(),font().family());
p.end();
addItem(QIcon(pix), name, JKQTPGraphSymbols2String(symbol));
}
@@ -186,7 +186,7 @@ void JKQTPLinePlotStyleComboBox::addSymbol(JKQTPGraphSymbols symbol, bool line,
p.begin(&pix);
p.setRenderHint(JKQTPEnhancedPainter::Antialiasing);
p.setRenderHint(JKQTPEnhancedPainter::TextAntialiasing);
- JKQTPPlotSymbol(p, 6.0*dpr,6.0*dpr,symbol,7.0*dpr,1,QColor("blue"), QColor("blue").lighter());
+ JKQTPPlotSymbol(p, 6.0*dpr,6.0*dpr,symbol,7.0*dpr,1,QColor("blue"), QColor("blue").lighter(), font().family());
p.setPen(QColor("blue"));
if (line) p.drawLine(0,6*dpr,12*dpr,6*dpr);
p.end();
@@ -505,7 +505,7 @@ void JKQTPLinePlotStyleWithSymbolSizeComboBox::addSymbol(JKQTPGraphSymbols symbo
p.begin(&pix);
p.setRenderHint(JKQTPEnhancedPainter::Antialiasing);
p.setRenderHint(JKQTPEnhancedPainter::TextAntialiasing);
- JKQTPPlotSymbol(p, double(pixSize)/2.0,double(pixSize)/2.0,symbol,symbolSize,1,QColor("blue"), QColor("blue").lighter());
+ JKQTPPlotSymbol(p, double(pixSize)/2.0,double(pixSize)/2.0,symbol,symbolSize,1,QColor("blue"), QColor("blue").lighter(), font().family());
p.setPen(QColor("blue"));
if (line) p.drawLine(QLineF(0,double(pixSize)/2.0,pixSize,double(pixSize)/2.0));
p.end();
diff --git a/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.cpp b/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.cpp
index e0da420c6e..4d3b0a2e8c 100644
--- a/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.cpp
+++ b/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.cpp
@@ -207,6 +207,7 @@ JKQTPGraphSymbolStyleMixin::JKQTPGraphSymbolStyleMixin()
m_symbolSize=12;
m_symbolFillColor=m_symbolColor.lighter();
m_symbolLineWidth=1;
+ m_symbolFontName=QGuiApplication::font().family();
}
void JKQTPGraphSymbolStyleMixin::initSymbolStyle(JKQTBasePlotter *parent, int& parentPlotStyle, JKQTPPlotStyleType styletype)
@@ -219,6 +220,7 @@ void JKQTPGraphSymbolStyleMixin::initSymbolStyle(JKQTBasePlotter *parent, int& p
m_symbolLineWidth=pen.symbolLineWidthF();
m_symbolType=pen.symbol();
m_symbolFillColor=pen.symbolFillColor();
+ m_symbolFontName=parent->getDefaultTextFontName();
}
}
@@ -277,6 +279,16 @@ double JKQTPGraphSymbolStyleMixin::getSymbolLineWidth() const
return m_symbolLineWidth;
}
+void JKQTPGraphSymbolStyleMixin::setSymbolFontName(const QString &__value)
+{
+ m_symbolFontName=__value;
+}
+
+QString JKQTPGraphSymbolStyleMixin::getSymbolFontName() const
+{
+ return m_symbolFontName;
+}
+
double JKQTPGraphSymbolStyleMixin::getKeySymbolLineWidthPx(JKQTPEnhancedPainter& painter, const QRectF& keyRect, const JKQTBasePlotter *parent, double maxSymbolSizeFracton) const
{
const double minSize=qMin(keyRect.width(), keyRect.height());
@@ -310,25 +322,20 @@ QBrush JKQTPGraphSymbolStyleMixin::getSymbolBrush(JKQTPEnhancedPainter& /*painte
return b;
}
-void JKQTPGraphSymbolStyleMixin::plotStyledSymbol(JKQTBasePlotter* parent, JKQTPEnhancedPainter &painter, double x, double y) const
+QFont JKQTPGraphSymbolStyleMixin::getSymbolFont() const
{
- JKQTPPlotSymbol(painter, x, y,m_symbolType, parent->pt2px(painter, m_symbolSize), parent->pt2px(painter, m_symbolLineWidth*parent->getLineWidthMultiplier()), m_symbolColor, m_symbolFillColor);
+ QFont f(m_symbolFontName, m_symbolSize);
+ f.setStyleStrategy(QFont::PreferDefault);
+ return f;
}
-void JKQTPGraphSymbolStyleMixin::plotStyledSymbol(JKQTBasePlotter* parent, JKQTPEnhancedPainter &painter, double x, double y, JKQTPGraphSymbols type) const
-{
- JKQTPPlotSymbol(painter, x, y,type, parent->pt2px(painter, m_symbolSize), parent->pt2px(painter, m_symbolLineWidth*parent->getLineWidthMultiplier()), m_symbolColor, m_symbolFillColor);
-}
-void JKQTPGraphSymbolStyleMixin::plotStyledSymbol(JKQTBasePlotter* parent, JKQTPEnhancedPainter &painter, double x, double y, double symbolSize) const
-{
- JKQTPPlotSymbol(painter, x, y,m_symbolType, symbolSize, parent->pt2px(painter, m_symbolLineWidth*parent->getLineWidthMultiplier()), m_symbolColor, m_symbolFillColor);
-}
-void JKQTPGraphSymbolStyleMixin::plotStyledSymbol(JKQTBasePlotter* parent, JKQTPEnhancedPainter &painter, double x, double y, QColor color, QColor fillColor) const
-{
- JKQTPPlotSymbol(painter, x, y,m_symbolType, parent->pt2px(painter, m_symbolSize), parent->pt2px(painter, m_symbolLineWidth*parent->getLineWidthMultiplier()), color, fillColor);
-}
+
+
+
+
+
diff --git a/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.h b/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.h
index 1930ab6941..bd48888b0f 100644
--- a/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.h
+++ b/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.h
@@ -363,6 +363,7 @@ private:
- symbol (outline) color
- symbol fill color (not required for all symbols)
- symbol (line) width
+ - symbol font name (family) for character symbols \c JKQTPCharacterSymbol+QChar('').unicode()
.
*/
class JKQTPLOTTER_LIB_EXPORT JKQTPGraphSymbolStyleMixin {
@@ -402,6 +403,11 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGraphSymbolStyleMixin {
/** \brief get the line width of the graph symbol outline (in pt) */
double getSymbolLineWidth() const;
+ /** \brief set the font to be used for character symbols \c JKQTPCharacterSymbol+QChar('').unicode() */
+ void setSymbolFontName(const QString& __value);
+ /** \brief get the font to be used for character symbols \c JKQTPCharacterSymbol+QChar('').unicode() */
+ QString getSymbolFontName() const;
+
#ifndef JKQTPLOTTER_WORKAROUND_QGADGET_BUG
@@ -410,8 +416,9 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGraphSymbolStyleMixin {
Q_PROPERTY(QColor symbolFillColor MEMBER m_symbolFillColor READ getSymbolFillColor WRITE setSymbolFillColor)
Q_PROPERTY(double symbolSize MEMBER m_symbolSize READ getSymbolSize WRITE setSymbolSize)
Q_PROPERTY(double symbolLineWidth MEMBER m_symbolLineWidth READ getSymbolLineWidth WRITE setSymbolLineWidth)
+ Q_PROPERTY(QString symbolFontName MEMBER m_symbolFontName READ getSymbolFontName WRITE setSymbolFontName)
#endif
-private:
+ private:
/** \brief which symbol to use for the datapoints */
JKQTPGraphSymbols m_symbolType;
/** \brief size (diameter in pt) of the symbol for the data points, given in pt */
@@ -422,11 +429,15 @@ private:
QColor m_symbolFillColor;
/** \brief width (in pt) of the lines used to plot the symbol for the data points, given in pt */
double m_symbolLineWidth;
+ /** \brief font to be used for character symbols \c JKQTPCharacterSymbol+QChar('').unicode() */
+ QString m_symbolFontName;
protected:
/** \brief constructs a QPen from the line styling properties */
QPen getSymbolPen(JKQTPEnhancedPainter &painter, JKQTBasePlotter* parent) const;
/** \brief constructs a QPen from the line styling properties */
QBrush getSymbolBrush(JKQTPEnhancedPainter &painter, JKQTBasePlotter* parent) const;
+ /** \brief generate a QFont for darwing symbols */
+ QFont getSymbolFont() const;
/*! \brief plot a symbol at location x,y (in painter coordinates), using the current style
\param parent parent JKQTBasePlotter of the graph that uses this mix-in (used e.g. for line-width transformation)
@@ -434,7 +445,10 @@ private:
\param x x-coordinate of the symbol center
\param y y-coordinate of the symbol center
*/
- void plotStyledSymbol(JKQTBasePlotter* parent, JKQTPEnhancedPainter& painter, double x, double y) const;
+ inline void plotStyledSymbol(JKQTBasePlotter* parent, JKQTPEnhancedPainter& painter, double x, double y) const
+ {
+ JKQTPPlotSymbol(painter, x, y,m_symbolType, parent->pt2px(painter, m_symbolSize), parent->pt2px(painter, m_symbolLineWidth*parent->getLineWidthMultiplier()), m_symbolColor, m_symbolFillColor, getSymbolFont());
+ }
/*! \brief plot a symbol at location x,y (in painter coordinates), using the current style
\param parent parent JKQTBasePlotter of the graph that uses this mix-in (used e.g. for line-width transformation)
@@ -443,7 +457,10 @@ private:
\param y y-coordinate of the symbol center
\param symbolSize size of the symbol
*/
- void plotStyledSymbol(JKQTBasePlotter* parent, JKQTPEnhancedPainter& painter, double x, double y, double symbolSize) const;
+ inline void plotStyledSymbol(JKQTBasePlotter* parent, JKQTPEnhancedPainter& painter, double x, double y, double symbolSize) const
+ {
+ JKQTPPlotSymbol(painter, x, y,m_symbolType, symbolSize, parent->pt2px(painter, m_symbolLineWidth*parent->getLineWidthMultiplier()), m_symbolColor, m_symbolFillColor, getSymbolFont());
+ }
/*! \brief plot a symbol at location x,y (in painter coordinates), using the current style
\param parent parent JKQTBasePlotter of the graph that uses this mix-in (used e.g. for line-width transformation)
@@ -452,7 +469,10 @@ private:
\param y y-coordinate of the symbol center
\param type type of the symbol
*/
- void plotStyledSymbol(JKQTBasePlotter* parent, JKQTPEnhancedPainter& painter, double x, double y, JKQTPGraphSymbols type) const;
+ inline void plotStyledSymbol(JKQTBasePlotter* parent, JKQTPEnhancedPainter& painter, double x, double y, JKQTPGraphSymbols type) const
+ {
+ JKQTPPlotSymbol(painter, x, y,type, parent->pt2px(painter, m_symbolSize), parent->pt2px(painter, m_symbolLineWidth*parent->getLineWidthMultiplier()), m_symbolColor, m_symbolFillColor, getSymbolFont());
+ }
/*! \brief plot a symbol at location x,y (in painter coordinates), using the current style
\param parent parent JKQTBasePlotter of the graph that uses this mix-in (used e.g. for line-width transformation)
@@ -462,7 +482,10 @@ private:
\param color color of the symbol
\param fillColor fill color of the symbol
*/
- void plotStyledSymbol(JKQTBasePlotter* parent, JKQTPEnhancedPainter& painter, double x, double y, QColor color, QColor fillColor) const;
+ inline void plotStyledSymbol(JKQTBasePlotter* parent, JKQTPEnhancedPainter& painter, double x, double y, QColor color, QColor fillColor) const
+ {
+ JKQTPPlotSymbol(painter, x, y,m_symbolType, parent->pt2px(painter, m_symbolSize), parent->pt2px(painter, m_symbolLineWidth*parent->getLineWidthMultiplier()), color, fillColor, getSymbolFont());
+ }
/** \brief returns the symbol linewidth for drawing symbols in a key entry with \a keyRect for the symbol, using \a painter and \a parent . \a maxSymbolSizeFracton specifies the maximum fraction of \a keyRect to be used for the symbol. */
double getKeySymbolLineWidthPx(JKQTPEnhancedPainter &painter, const QRectF &keyRect, const JKQTBasePlotter *parent, double maxSymbolSizeFracton=0.9) const;
/** \brief returns the symbol size for drawing symbols in a key entry with \a keyRect for the symbol, using \a painter and \a parent . \a maxSymbolSizeFracton specifies the maximum fraction of \a keyRect to be used for the symbol. */