diff --git a/examples/styling/build_test_graphs.h b/examples/styling/build_test_graphs.h index bc9cacca3d..aa8d6f801c 100644 --- a/examples/styling/build_test_graphs.h +++ b/examples/styling/build_test_graphs.h @@ -304,7 +304,7 @@ inline void buildLineSymbolSampler(JKQTBasePlotter* plotExtra, JKQTBasePlotter* double dx=(xmax-xlineend-1.0)/static_cast(cntFillTests); for (int i=0; igetCurrentPlotterStyle().graphsStyle.defaultGraphColors.value(i%baseplot->getCurrentPlotterStyle().graphsStyle.defaultGraphColors.size(), Qt::black); - const auto fs=baseplot->getCurrentPlotterStyle().graphsStyle.defaultGraphFillStyles.value(i%baseplot->getCurrentPlotterStyle().graphsStyle.defaultGraphFillStyles.size(), Qt::SolidPattern); + const auto fs=baseplot->getCurrentPlotterStyle().graphsStyle.defaultGraphFillStyles.value(i%baseplot->getCurrentPlotterStyle().graphsStyle.defaultGraphFillStyles.size(), JKQTFillStyleSummmary(Qt::SolidPattern)); JKQTPGeoLine* l; plotExtra->addGraph(l=new JKQTPGeoLine(plotExtra, x,ycoltest,x,y-0.5)); l->setStyle(col,5); JKQTPGeoRectangle* r; diff --git a/lib/jkqtplotter/graphs/jkqtpgeobase.cpp b/lib/jkqtplotter/graphs/jkqtpgeobase.cpp index 24f351d4b3..36fff4fea9 100644 --- a/lib/jkqtplotter/graphs/jkqtpgeobase.cpp +++ b/lib/jkqtplotter/graphs/jkqtpgeobase.cpp @@ -115,6 +115,14 @@ void JKQTPGeoBaseFilled::setStyle(QColor color, double lineWidth, Qt::PenStyle s setFillStyle(fillStyle); } +void JKQTPGeoBaseFilled::setStyle(QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, const JKQTFillStyleSummmary &fillStyle) +{ + setLineColor(color); + setLineWidth(lineWidth); + setLineStyle(style); + setFillBrush(fillStyle.brush(fillColor)); +} + void JKQTPGeoBaseFilled::setStyle(QColor color, double lineWidth, Qt::PenStyle style) { setLineColor(color); diff --git a/lib/jkqtplotter/graphs/jkqtpgeobase.h b/lib/jkqtplotter/graphs/jkqtpgeobase.h index 73260744bb..1de1e3bb5b 100644 --- a/lib/jkqtplotter/graphs/jkqtpgeobase.h +++ b/lib/jkqtplotter/graphs/jkqtpgeobase.h @@ -193,6 +193,8 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoBaseFilled: public JKQTPGeoBaseLine, public /** \brief set several of the style properties with one call */ virtual void setStyle(QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle) ; /** \brief set several of the style properties with one call */ + virtual void setStyle(QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, const JKQTFillStyleSummmary& fillStyle) ; + /** \brief set several of the style properties with one call */ virtual void setStyle(QColor color, double lineWidth, Qt::PenStyle style) override; /** \brief set several of the style properties with one call */ virtual void setStyle(QColor color, Qt::PenStyle style) override; diff --git a/lib/jkqtplotter/jkqtpbaseplotter.cpp b/lib/jkqtplotter/jkqtpbaseplotter.cpp index 8f31358824..7edfa3e90a 100644 --- a/lib/jkqtplotter/jkqtpbaseplotter.cpp +++ b/lib/jkqtplotter/jkqtpbaseplotter.cpp @@ -1151,21 +1151,21 @@ JKQTBasePlotter::JKQTPPen JKQTBasePlotter::getPlotStyle(int i, JKQTPPlotStyleTyp //std::cout<<"style "< JKQTGraphsBaseStyle::getDefaultGraphSymbols() return syms; } -QVector JKQTGraphsBaseStyle::getDefaultGraphFillStyles() +QVector JKQTGraphsBaseStyle::getDefaultGraphFillStyles() { - return QVector()<()<=0) { - defaultGraphFillStyles.push_back(jkqtp_String2QBrushStyle(settings.value(group+"auto_styles/fill_style"+QString::number(id), jkqtp_QBrushStyle2String(Qt::SolidPattern)).toString())); + defaultGraphFillStyles.push_back(JKQTFillStyleSummmary::fromString(settings.value(group+"auto_styles/fill_style"+QString::number(id), jkqtp_QBrushStyle2String(Qt::SolidPattern)).toString())); } } if (defaultGraphColors.size()==0) { @@ -398,7 +398,7 @@ void JKQTGraphsBaseStyle::saveSettings(QSettings &settings, const QString &group for (auto& gs: defaultGraphFillStyles) { QString num=QString::number(cnt); while (num.size() defaultGraphSymbols; /** \brief Qt::BrushStyle used to automatically style different graphs differently */ - QVector defaultGraphFillStyles; + QVector defaultGraphFillStyles; /** \brief standard color palette for the default style */ static QVector getDefaultGraphColors(); @@ -367,7 +390,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTGraphsBaseStyle { /** \brief list of JKQTPGraphSymbols used to automatically assign to different graphs in the default style */ static QVector getDefaultGraphSymbols(); /** \brief list of Qt::BrushStyle used to automatically style different graphs differently in the default style */ - static QVector getDefaultGraphFillStyles(); + static QVector getDefaultGraphFillStyles(); }; diff --git a/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.cpp b/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.cpp index f66e322998..f75e025c01 100644 --- a/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.cpp +++ b/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.cpp @@ -398,8 +398,7 @@ void JKQTPGraphFillStyleMixin::initFillStyle(JKQTBasePlotter *parent, int &paren if (parentPlotStyle<0) parentPlotStyle=parent->getNextStyle(); const JKQTBasePlotter::JKQTPPen pen=parent->getPlotStyle(parentPlotStyle, styletype); m_fillColor=pen.fillColor(); - m_fillBrush.setColor(m_fillColor); - m_fillBrush.setStyle(pen.fillStyle()); + m_fillBrush=pen.fillStyle().brush(m_fillColor); } }