mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-12-25 10:01:38 +08:00
several bugfixes for reading styles, improved default styling for graphs (filled, barcharts, ...)
This commit is contained in:
parent
fc321f027b
commit
534745229d
@ -142,7 +142,7 @@ void TestStyling::initPlot()
|
||||
Y5<<2.5*exp(-x/10.0)+1.0;
|
||||
if (i%5==0) {
|
||||
X3<<x;
|
||||
Y3<<(1.5+Y1.last());
|
||||
Y3<<(2.5+Y1.last());
|
||||
Y3err<<(double(i+5)/double(Ndata)*0.5);
|
||||
}
|
||||
if (i>0 && i%20==0) {
|
||||
@ -228,7 +228,8 @@ void TestStyling::initPlot()
|
||||
graph3->setXColumn(columnX3);
|
||||
graph3->setYColumn(columnY3);
|
||||
graph3->setYErrorColumn(columnY3err);
|
||||
graph3->setDrawLine(false);
|
||||
graph3->setDrawLine(true);
|
||||
graph3->setYErrorStyle(JKQTPErrorBarsPolygons);
|
||||
graph3->setTitle(QObject::tr("sine \\pm errors graph"));
|
||||
ui->plot->addGraph(graph3);
|
||||
|
||||
@ -318,13 +319,16 @@ void TestStyling::initPlot()
|
||||
y+=0.75;
|
||||
}
|
||||
x=xlineend+1;
|
||||
double dx=(xmax-xlineend-1.0)/static_cast<double>(ui->plot->getPlotter()->getCurrentPlotterStyle().graphsStyle.defaultGraphColors.size());
|
||||
for (auto s: ui->plot->getPlotter()->getCurrentPlotterStyle().graphsStyle.defaultGraphColors) {
|
||||
const int cntFillTests=qMax(ui->plot->getPlotter()->getCurrentPlotterStyle().graphsStyle.defaultGraphColors.size(), ui->plot->getPlotter()->getCurrentPlotterStyle().graphsStyle.defaultGraphFillStyles.size());
|
||||
double dx=(xmax-xlineend-1.0)/static_cast<double>(cntFillTests);
|
||||
for (int i=0; i<cntFillTests; i++) {
|
||||
const auto col=ui->plot->getPlotter()->getCurrentPlotterStyle().graphsStyle.defaultGraphColors.value(i%ui->plot->getPlotter()->getCurrentPlotterStyle().graphsStyle.defaultGraphColors.size(), Qt::black);
|
||||
const auto fs=ui->plot->getPlotter()->getCurrentPlotterStyle().graphsStyle.defaultGraphFillStyles.value(i%ui->plot->getPlotter()->getCurrentPlotterStyle().graphsStyle.defaultGraphFillStyles.size(), Qt::SolidPattern);
|
||||
JKQTPGeoLine* l;
|
||||
plotExtra->addGraph(l=new JKQTPGeoLine(plotExtra.data(), x,ycoltest,x,y-0.5)); l->setStyle(s,5);
|
||||
plotExtra->addGraph(l=new JKQTPGeoLine(plotExtra.data(), x,ycoltest,x,y-0.5)); l->setStyle(col,5);
|
||||
JKQTPGeoRectangle* r;
|
||||
plotExtra->addGraph(r=new JKQTPGeoRectangle(plotExtra.data(), x+dx/2,(ycoltest+y-0.5)/2.0, dx*0.5, y-ycoltest-0.5));
|
||||
r->setStyle(s,1, Qt::SolidLine, JKQTPGetDerivedColor(ui->plot->getPlotter()->getCurrentPlotterStyle().graphsStyle.defaultGraphStyle.fillColorDerivationMode, s), Qt::SolidPattern);
|
||||
r->setStyle(col,1, Qt::SolidLine, JKQTPGetDerivedColor(ui->plot->getPlotter()->getCurrentPlotterStyle().graphsStyle.defaultGraphStyle.fillColorDerivationMode, col), fs);
|
||||
x+=dx;
|
||||
}
|
||||
plotExtra->zoomToFit();
|
||||
|
@ -1009,6 +1009,9 @@ JKQTBasePlotter::JKQTPPen JKQTBasePlotter::getPlotStyle(int i, JKQTPPlotStyleTyp
|
||||
basebrushStyle=plotterStyle.graphsStyle.annotationStyle.defaultFillStyle;
|
||||
baseSymbol=plotterStyle.graphsStyle.annotationStyle.defaultSymbol;
|
||||
}
|
||||
if (type==JKQTPPlotStyleType::Barchart || type==JKQTPPlotStyleType::Boxplot || type==JKQTPPlotStyleType::Impulses) {
|
||||
basePenStyle=Qt::SolidLine;
|
||||
}
|
||||
const QColor lineColor=JKQTPGetDerivedColor(baseProps.graphColorDerivationMode, baseColor);
|
||||
const QColor errorColor=JKQTPGetDerivedColor(baseProps.errorColorDerivationMode, baseColor);
|
||||
|
||||
@ -1016,15 +1019,16 @@ JKQTBasePlotter::JKQTPPen JKQTBasePlotter::getPlotStyle(int i, JKQTPPlotStyleTyp
|
||||
p.setStyle(basePenStyle);
|
||||
p.setSymbolType(baseSymbol);
|
||||
p.setFillStyle(basebrushStyle);
|
||||
p.setErrorFillStyle(basebrushStyle);
|
||||
p.setErrorFillStyle(Qt::SolidPattern);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH, baseProps.defaultLineWidth));
|
||||
p.setFillColor(JKQTPGetDerivedColor(baseProps.fillColorDerivationMode, baseColor));
|
||||
p.setErrorLineColor(errorColor);
|
||||
p.setErrorFillColor(JKQTPGetDerivedColor(baseProps.errorFillColorDerivationMode, baseColor));
|
||||
//qDebug()<<"baseColor="<<baseColor<<"/"<<baseColor.alphaF()*100.0<<"% --> ErrorFillColor="<<p.errorFillColor()<<"/"<<p.errorFillColor().alphaF()*100.0<<"%";
|
||||
p.setErrorLineWidth(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH, baseProps.defaultErrorIndicatorWidth));
|
||||
p.setSymbolSize(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH, baseProps.defaultSymbolSize));
|
||||
p.setSymbolFillColor(JKQTPGetDerivedColor(baseProps.symbolFillColorDerivationMode, baseColor));
|
||||
p.setSymbolLineWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH, baseProps.defaultSymbolLineSize));
|
||||
p.setSymbolLineWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH, baseProps.defaultSymbolLineWidth));
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ void JKQTBasePlotterStyle::loadSettings(const QSettings &settings, const QString
|
||||
debugShowRegionBoxes=settings.value(group+"debug_show_region_boxes", defaultStyle.debugShowRegionBoxes).toBool();
|
||||
debugRegionLineWidth=settings.value(group+"debug_region_linewidth", defaultStyle.debugRegionLineWidth).toDouble();
|
||||
plotLabelFontName=settings.value(group+"plot_label_font_name", defaultStyle.plotLabelFontName).toString();
|
||||
plotLabelFontSize=settings.value(group+"plot_label_font_size", defaultStyle.debugRegionLineWidth).toDouble();
|
||||
plotLabelFontSize=settings.value(group+"plot_label_font_size", defaultStyle.plotLabelFontSize).toDouble();
|
||||
widgetBackgroundBrush=QBrush(jkqtp_String2QColor(settings.value(group+"widget_background_color", jkqtp_QColor2String(defaultStyle.widgetBackgroundBrush.color())).toString()));
|
||||
exportBackgroundBrush=QBrush(jkqtp_String2QColor(settings.value(group+"widget_background_color_for_export", jkqtp_QColor2String(defaultStyle.exportBackgroundBrush.color())).toString()));
|
||||
plotBackgroundBrush=QBrush(jkqtp_String2QColor(settings.value(group+"plot_background_color", jkqtp_QColor2String(defaultStyle.plotBackgroundBrush.color())).toString()));
|
||||
|
@ -9,20 +9,34 @@
|
||||
JKQTGraphsSpecificStyleProperties::JKQTGraphsSpecificStyleProperties(JKQTPPlotStyleType type, const JKQTBasePlotterStyle &/*parent*/):
|
||||
defaultLineWidth(2),
|
||||
defaultSymbolSize(10),
|
||||
defaultSymbolLineSize(1),
|
||||
defaultSymbolLineWidth(1),
|
||||
defaultErrorIndicatorWidth(1),
|
||||
defaultHeadDecoratorStyle(JKQTPLineDecoratorStyle::JKQTPDefaultLineDecorator),
|
||||
defaultHeadDecoratorSizeFactor(8.0),
|
||||
errorFillStyle(Qt::SolidPattern),
|
||||
graphColorDerivationMode(JKQTPFFCMSameColor),
|
||||
fillColorDerivationMode(JKQTPFFCMLighterColor),
|
||||
errorColorDerivationMode(JKQTPFFCMDarkerColor),
|
||||
errorFillColorDerivationMode(JKQTPFFCMEvenLighterColor),
|
||||
errorFillColorDerivationMode(JKQTPFFCMLighterAndTransparentColor),
|
||||
symbolFillColorDerivationMode(JKQTPFFCMLighterColor)
|
||||
{
|
||||
modifyForDefaultStyle(type);
|
||||
}
|
||||
|
||||
JKQTGraphsSpecificStyleProperties::JKQTGraphsSpecificStyleProperties(JKQTPPlotStyleType type, const JKQTGraphsSpecificStyleProperties &other):
|
||||
JKQTGraphsSpecificStyleProperties(other)
|
||||
{
|
||||
modifyForDefaultStyle(type);
|
||||
}
|
||||
|
||||
|
||||
void JKQTGraphsSpecificStyleProperties::modifyForDefaultStyle(JKQTPPlotStyleType type)
|
||||
{
|
||||
switch(type) {
|
||||
case JKQTPPlotStyleType::Default:
|
||||
break;
|
||||
case JKQTPPlotStyleType::Filled:
|
||||
fillColorDerivationMode=JKQTPFFCMLighterAndTransparentColor;
|
||||
break;
|
||||
case JKQTPPlotStyleType::Impulses:
|
||||
defaultLineWidth=3;
|
||||
@ -49,10 +63,11 @@ void JKQTGraphsSpecificStyleProperties::loadSettings(const QSettings &settings,
|
||||
{
|
||||
defaultLineWidth=settings.value(group+"linewidth", defaultStyle.defaultLineWidth).toDouble();
|
||||
defaultSymbolSize=settings.value(group+"symbol_size", defaultStyle.defaultSymbolSize).toDouble();
|
||||
defaultSymbolLineSize=settings.value(group+"symbol_line_size", defaultStyle.defaultLineWidth).toDouble();
|
||||
defaultErrorIndicatorWidth=settings.value(group+"error_indicator_width", defaultStyle.defaultLineWidth).toDouble();
|
||||
defaultSymbolLineWidth=settings.value(group+"symbol_line_width", defaultStyle.defaultSymbolLineWidth).toDouble();
|
||||
defaultErrorIndicatorWidth=settings.value(group+"error_indicator_width", defaultStyle.defaultErrorIndicatorWidth).toDouble();
|
||||
defaultHeadDecoratorStyle=String2JKQTPLineDecoratorStyle(settings.value(group+"head_decorator_type", JKQTPLineDecoratorStyle2String(defaultStyle.defaultHeadDecoratorStyle)).toString());
|
||||
defaultHeadDecoratorSizeFactor=settings.value(group+"head_decorator_size_factor", defaultStyle.defaultHeadDecoratorSizeFactor).toDouble();
|
||||
errorFillStyle=jkqtp_String2QBrushStyle(settings.value(group+"error_fill_style", jkqtp_QBrushStyle2String(errorFillStyle)).toString());
|
||||
|
||||
graphColorDerivationMode=String2JKQTPColorDerivationMode(settings.value(group+"graph_color_mode", JKQTPColorDerivationMode2String(defaultStyle.graphColorDerivationMode)).toString());
|
||||
fillColorDerivationMode=String2JKQTPColorDerivationMode(settings.value(group+"fill_color_mode", JKQTPColorDerivationMode2String(defaultStyle.fillColorDerivationMode)).toString());
|
||||
@ -66,10 +81,11 @@ void JKQTGraphsSpecificStyleProperties::saveSettings(QSettings &settings, const
|
||||
{
|
||||
settings.setValue(group+"linewidth", defaultLineWidth);
|
||||
settings.setValue(group+"symbol_size", defaultSymbolSize);
|
||||
settings.setValue(group+"symbol_line_size", defaultSymbolLineSize);
|
||||
settings.setValue(group+"symbol_line_width", defaultSymbolLineWidth);
|
||||
settings.setValue(group+"error_indicator_width", defaultErrorIndicatorWidth);
|
||||
settings.setValue(group+"head_decorator_size_factor", defaultHeadDecoratorSizeFactor);
|
||||
settings.setValue(group+"head_decorator_type", JKQTPLineDecoratorStyle2String(defaultHeadDecoratorStyle));
|
||||
settings.setValue(group+"error_fill_style", jkqtp_QBrushStyle2String(errorFillStyle));
|
||||
|
||||
settings.setValue(group+"graph_color_mode", JKQTPColorDerivationMode2String(graphColorDerivationMode));
|
||||
settings.setValue(group+"fill_color_mode", JKQTPColorDerivationMode2String(fillColorDerivationMode));
|
||||
@ -79,6 +95,7 @@ void JKQTGraphsSpecificStyleProperties::saveSettings(QSettings &settings, const
|
||||
}
|
||||
|
||||
|
||||
|
||||
JKQTGeometricSpecificStyleProperties::JKQTGeometricSpecificStyleProperties(const JKQTBasePlotterStyle& parent):
|
||||
JKQTGraphsSpecificStyleProperties(JKQTPPlotStyleType::Geometric, parent),
|
||||
defaultColor(parent.defaultTextColor),
|
||||
@ -90,7 +107,7 @@ JKQTGeometricSpecificStyleProperties::JKQTGeometricSpecificStyleProperties(const
|
||||
}
|
||||
|
||||
JKQTGeometricSpecificStyleProperties::JKQTGeometricSpecificStyleProperties(const JKQTBasePlotterStyle& parent, const JKQTGraphsSpecificStyleProperties &other):
|
||||
JKQTGraphsSpecificStyleProperties(other),
|
||||
JKQTGraphsSpecificStyleProperties(JKQTPPlotStyleType::Geometric, other),
|
||||
defaultColor(parent.defaultTextColor),
|
||||
defaultLineStyle(Qt::SolidLine),
|
||||
defaultSymbol(JKQTPGraphSymbols::JKQTPCross),
|
||||
@ -109,8 +126,18 @@ JKQTGeometricSpecificStyleProperties::JKQTGeometricSpecificStyleProperties(JKQTP
|
||||
|
||||
}
|
||||
|
||||
JKQTGeometricSpecificStyleProperties::JKQTGeometricSpecificStyleProperties(JKQTPPlotStyleType type, const JKQTGraphsSpecificStyleProperties &other, const JKQTBasePlotterStyle &parent):
|
||||
JKQTGraphsSpecificStyleProperties(type, other),
|
||||
defaultColor(parent.defaultTextColor),
|
||||
defaultLineStyle(Qt::SolidLine),
|
||||
defaultSymbol(JKQTPGraphSymbols::JKQTPCross),
|
||||
defaultFillStyle(Qt::SolidPattern)
|
||||
{
|
||||
|
||||
void JKQTGeometricSpecificStyleProperties::loadSettings(const QSettings &settings, const QString &group, const JKQTGraphsSpecificStyleProperties &defaultStyle)
|
||||
}
|
||||
|
||||
|
||||
void JKQTGeometricSpecificStyleProperties::loadSettings(const QSettings &settings, const QString &group, const JKQTGeometricSpecificStyleProperties &defaultStyle)
|
||||
{
|
||||
JKQTGraphsSpecificStyleProperties::loadSettings(settings, group, defaultStyle);
|
||||
defaultColor=jkqtp_String2QColor(settings.value(group+"color", jkqtp_QColor2String(defaultColor)).toString());
|
||||
@ -129,7 +156,7 @@ void JKQTGeometricSpecificStyleProperties::saveSettings(QSettings &settings, con
|
||||
}
|
||||
|
||||
JKQTAnnotationsSpecificStyleProperties::JKQTAnnotationsSpecificStyleProperties(const JKQTBasePlotterStyle& parent):
|
||||
JKQTGeometricSpecificStyleProperties(JKQTPPlotStyleType::Geometric, parent),
|
||||
JKQTGeometricSpecificStyleProperties(JKQTPPlotStyleType::Annotation, parent),
|
||||
defaultTextColor(parent.defaultTextColor),
|
||||
defaultFontSize(12),
|
||||
defaultFontName(parent.defaultFontName)
|
||||
@ -138,7 +165,7 @@ JKQTAnnotationsSpecificStyleProperties::JKQTAnnotationsSpecificStyleProperties(c
|
||||
}
|
||||
|
||||
JKQTAnnotationsSpecificStyleProperties::JKQTAnnotationsSpecificStyleProperties(const JKQTBasePlotterStyle& parent, const JKQTGraphsSpecificStyleProperties &other):
|
||||
JKQTGeometricSpecificStyleProperties(parent, other),
|
||||
JKQTGeometricSpecificStyleProperties(JKQTPPlotStyleType::Annotation, other, parent),
|
||||
defaultTextColor(parent.defaultTextColor),
|
||||
defaultFontSize(12),
|
||||
defaultFontName(parent.defaultFontName)
|
||||
@ -256,10 +283,10 @@ void JKQTGraphsBaseStyle::loadSettings(const QSettings &settings, const QString
|
||||
|
||||
|
||||
defaultGraphStyle.loadSettings(settings, group+"graphs_base/", JKQTGraphsSpecificStyleProperties(JKQTPPlotStyleType::Default, parent));
|
||||
barchartStyle.loadSettings(settings, group+"graphs_barchart/", defaultGraphStyle);
|
||||
boxplotStyle.loadSettings(settings, group+"graphs_boxplot/", defaultGraphStyle);
|
||||
filledStyle.loadSettings(settings, group+"graphs_filled/", defaultGraphStyle);
|
||||
impulseStyle.loadSettings(settings, group+"graphs_impulses/", defaultGraphStyle);
|
||||
barchartStyle.loadSettings(settings, group+"graphs_barchart/", JKQTGraphsSpecificStyleProperties(JKQTPPlotStyleType::Barchart, defaultGraphStyle));
|
||||
boxplotStyle.loadSettings(settings, group+"graphs_boxplot/", JKQTGraphsSpecificStyleProperties(JKQTPPlotStyleType::Boxplot, defaultGraphStyle));
|
||||
filledStyle.loadSettings(settings, group+"graphs_filled/", JKQTGraphsSpecificStyleProperties(JKQTPPlotStyleType::Filled, defaultGraphStyle));
|
||||
impulseStyle.loadSettings(settings, group+"graphs_impulses/",JKQTGraphsSpecificStyleProperties(JKQTPPlotStyleType::Impulses, defaultGraphStyle));
|
||||
geometricStyle.loadSettings(settings, group+"graphs_geometric/", JKQTGeometricSpecificStyleProperties(parent, defaultGraphStyle));
|
||||
annotationStyle.loadSettings(settings, group+"graphs_annotation/", JKQTAnnotationsSpecificStyleProperties(parent, defaultGraphStyle));
|
||||
|
||||
|
@ -47,7 +47,10 @@ class JKQTBasePlotterStyle; // forward
|
||||
class JKQTPLOTTER_LIB_EXPORT JKQTGraphsSpecificStyleProperties {
|
||||
Q_GADGET
|
||||
public:
|
||||
/** \brief initializes the object for the given \a type and takes some properties from the \a parent */
|
||||
JKQTGraphsSpecificStyleProperties(JKQTPPlotStyleType type, const JKQTBasePlotterStyle& parent);
|
||||
/** \brief initializes the object as a copy of \a other, but modified some properties for the given \a type */
|
||||
JKQTGraphsSpecificStyleProperties(JKQTPPlotStyleType type, const JKQTGraphsSpecificStyleProperties& other);
|
||||
JKQTGraphsSpecificStyleProperties(const JKQTGraphsSpecificStyleProperties& other)=default;
|
||||
JKQTGraphsSpecificStyleProperties(JKQTGraphsSpecificStyleProperties&& other)=default;
|
||||
JKQTGraphsSpecificStyleProperties& operator=(const JKQTGraphsSpecificStyleProperties& other)=default;
|
||||
@ -75,13 +78,15 @@ class JKQTPLOTTER_LIB_EXPORT JKQTGraphsSpecificStyleProperties {
|
||||
/** \brief size (in pt) of symbols used for newly added graphs */
|
||||
double defaultSymbolSize;
|
||||
/** \brief width (in pt) of the outline of symbols used for newly added graphs */
|
||||
double defaultSymbolLineSize;
|
||||
double defaultSymbolLineWidth;
|
||||
/** \brief width (in pt) of lines used for the error indicators of newly added graphs */
|
||||
double defaultErrorIndicatorWidth;
|
||||
/** \brief head decorator style */
|
||||
JKQTPLineDecoratorStyle defaultHeadDecoratorStyle;
|
||||
/** \brief head decorator size-factor, used to calculate the size of the arrow from the line width */
|
||||
double defaultHeadDecoratorSizeFactor;
|
||||
/** \↓brief fill style for error indicators */
|
||||
Qt::BrushStyle errorFillStyle;
|
||||
/** \brief defines how to derive the basic graph color for a new graph from the color selected from JKQTGraphsBaseStyle::defaultGraphColors
|
||||
*
|
||||
* This property is usually JKQTPFFCMSameColor, but can be changed to allow to e.g. fill
|
||||
@ -96,6 +101,9 @@ class JKQTPLOTTER_LIB_EXPORT JKQTGraphsSpecificStyleProperties {
|
||||
JKQTPColorDerivationMode errorFillColorDerivationMode;
|
||||
/** \brief defines how to derive a symbol fill color for a new graph */
|
||||
JKQTPColorDerivationMode symbolFillColorDerivationMode;
|
||||
protected:
|
||||
/** \brief modifies some of the settings to match the defaults for the given JKQTPPlotStyleType (e.g. sets line-width for impulses ...) */
|
||||
void modifyForDefaultStyle(JKQTPPlotStyleType type);
|
||||
};
|
||||
|
||||
|
||||
@ -111,6 +119,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTGraphsSpecificStyleProperties {
|
||||
JKQTGeometricSpecificStyleProperties(const JKQTBasePlotterStyle& parent);
|
||||
JKQTGeometricSpecificStyleProperties(const JKQTBasePlotterStyle& parent, const JKQTGraphsSpecificStyleProperties& other);
|
||||
JKQTGeometricSpecificStyleProperties(JKQTPPlotStyleType type, const JKQTBasePlotterStyle& parent);
|
||||
JKQTGeometricSpecificStyleProperties(JKQTPPlotStyleType type, const JKQTGraphsSpecificStyleProperties& other, const JKQTBasePlotterStyle &parent);
|
||||
JKQTGeometricSpecificStyleProperties(const JKQTGeometricSpecificStyleProperties& other)=default;
|
||||
JKQTGeometricSpecificStyleProperties(JKQTGeometricSpecificStyleProperties&& other)=default;
|
||||
JKQTGeometricSpecificStyleProperties& operator=(const JKQTGeometricSpecificStyleProperties& other)=default;
|
||||
@ -124,7 +133,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTGraphsSpecificStyleProperties {
|
||||
* \param defaultStyle If a setting cannot be found in \a settings, default values are taken from this object
|
||||
* By default, this is a default-constructed object
|
||||
*/
|
||||
void loadSettings(const QSettings &settings, const QString& group, const JKQTGraphsSpecificStyleProperties &defaultStyle);
|
||||
void loadSettings(const QSettings &settings, const QString& group, const JKQTGeometricSpecificStyleProperties &defaultStyle);
|
||||
|
||||
/** \brief saves the plot properties into a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings</a> object.
|
||||
*
|
||||
|
@ -385,12 +385,22 @@ QString JKQTPColorDerivationMode2String(JKQTPColorDerivationMode mode)
|
||||
case JKQTPFFCMGrey25: return "grey25";
|
||||
case JKQTPFFCMGrey50: return "grey50";
|
||||
case JKQTPFFCMGrey75: return "grey75";
|
||||
case JKQTPFFCMTransparentBlack: return "transparent_black";
|
||||
case JKQTPFFCMTransparentWhite: return "transparent_white";
|
||||
case JKQTPFFCMTransparentGrey25: return "transparent_grey25";
|
||||
case JKQTPFFCMTransparentGrey50: return "transparent_grey50";
|
||||
case JKQTPFFCMTransparentGrey75: return "transparent_grey75";
|
||||
case JKQTPFFCMSameColor: return "same";
|
||||
case JKQTPFFCMInvertedColor: return "inverted";
|
||||
case JKQTPFFCMTransparentInvertedColor: return "transparent_inverted";
|
||||
case JKQTPFFCMLighterColor: return "lighter";
|
||||
case JKQTPFFCMEvenLighterColor: return "even_lighter";
|
||||
case JKQTPFFCMDarkerColor: return "darker";
|
||||
case JKQTPFFCMEvenDarkerColor: return "even_darker";
|
||||
case JKQTPFFCMLighterAndTransparentColor: return "lighter_and_transparent";
|
||||
case JKQTPFFCMEvenLighterAndTransparentColor: return "even_lighter_and_transparent";
|
||||
case JKQTPFFCMDarkerAndTransparentColor: return "darker_and_transparent";
|
||||
case JKQTPFFCMEvenDarkerAndTransparentColor: return "even_darker_and_transparent";
|
||||
case JKQTPFFCMMoreTransparentColor: return "more_transparent";
|
||||
case JKQTPFFCMEvenMoreTransparentColor: return "even_more_transparent";
|
||||
case JKQTPFFCMLessTransparentColor: return "less_transparent";
|
||||
@ -409,11 +419,21 @@ JKQTPColorDerivationMode String2JKQTPColorDerivationMode(const QString &mode)
|
||||
if (m=="grey25") return JKQTPFFCMGrey25;
|
||||
if (m=="grey50") return JKQTPFFCMGrey50;
|
||||
if (m=="grey75") return JKQTPFFCMGrey75;
|
||||
if (m=="transparent_black" || m=="black_transparent") return JKQTPFFCMTransparentBlack;
|
||||
if (m=="transparent_white" || m=="white_transparent") return JKQTPFFCMTransparentWhite;
|
||||
if (m=="transparent_grey25" || m=="grey25_transparent") return JKQTPFFCMTransparentGrey25;
|
||||
if (m=="transparent_grey50" || m=="grey50_transparent") return JKQTPFFCMTransparentGrey50;
|
||||
if (m=="transparent_grey75" || m=="grey75_transparent") return JKQTPFFCMTransparentGrey75;
|
||||
if (m=="inverted") return JKQTPFFCMInvertedColor;
|
||||
if (m=="transparent_inverted" || m=="inverted_transparent") return JKQTPFFCMTransparentInvertedColor;
|
||||
if (m=="lighter") return JKQTPFFCMLighterColor;
|
||||
if (m=="even_lighter") return JKQTPFFCMEvenLighterColor;
|
||||
if (m=="darker") return JKQTPFFCMDarkerColor;
|
||||
if (m=="even_darker") return JKQTPFFCMEvenDarkerColor;
|
||||
if (m=="lighter_and_transparent") return JKQTPFFCMLighterAndTransparentColor;
|
||||
if (m=="even_lighter_and_transparent") return JKQTPFFCMEvenLighterAndTransparentColor;
|
||||
if (m=="darker_and_transparent") return JKQTPFFCMDarkerAndTransparentColor;
|
||||
if (m=="even_darker_and_transparent") return JKQTPFFCMEvenDarkerAndTransparentColor;
|
||||
if (m=="more_transparent") return JKQTPFFCMMoreTransparentColor;
|
||||
if (m=="even_more_transparent") return JKQTPFFCMEvenMoreTransparentColor;
|
||||
if (m=="less_transparent") return JKQTPFFCMLessTransparentColor;
|
||||
@ -428,14 +448,48 @@ QColor JKQTPGetDerivedColor(JKQTPColorDerivationMode mode, const QColor &basecol
|
||||
case JKQTPFFCMFullyTransparentColor: return QColor(Qt::transparent);
|
||||
case JKQTPFFCMBlack: return QColor(Qt::black);
|
||||
case JKQTPFFCMWhite: return QColor(Qt::white);
|
||||
case JKQTPFFCMGrey25: return QColor(static_cast<uint8_t>(0.25*255.0),static_cast<uint8_t>(0.25*255.0),static_cast<uint8_t>(0.25*255.0));
|
||||
case JKQTPFFCMGrey50: return QColor(static_cast<uint8_t>(0.50*255.0),static_cast<uint8_t>(0.50*255.0),static_cast<uint8_t>(0.50*255.0));
|
||||
case JKQTPFFCMGrey75: return QColor(static_cast<uint8_t>(0.75*255.0),static_cast<uint8_t>(0.75*255.0),static_cast<uint8_t>(0.75*255.0));
|
||||
case JKQTPFFCMInvertedColor: return QColor(255-basecolor.red(), 255-basecolor.green(), 255-basecolor.blue(), basecolor.alpha());
|
||||
case JKQTPFFCMLighterColor: return basecolor.lighter();
|
||||
case JKQTPFFCMEvenLighterColor: return basecolor.lighter().lighter();
|
||||
case JKQTPFFCMDarkerColor: return basecolor.darker();
|
||||
case JKQTPFFCMEvenDarkerColor: return basecolor.darker().darker();
|
||||
case JKQTPFFCMGrey25: return QColor(64,64,64);
|
||||
case JKQTPFFCMGrey50: return QColor(127,127,127);
|
||||
case JKQTPFFCMGrey75: return QColor(191,191,191);
|
||||
case JKQTPFFCMTransparentBlack: return QColor(0,0,0,175);
|
||||
case JKQTPFFCMTransparentWhite: return QColor(255,255,255,175);
|
||||
case JKQTPFFCMTransparentGrey25: return QColor(64,64,64,175);
|
||||
case JKQTPFFCMTransparentGrey50: return QColor(127,127,127,175);
|
||||
case JKQTPFFCMTransparentGrey75: return QColor(191,191,191,175);
|
||||
case JKQTPFFCMInvertedColor:
|
||||
case JKQTPFFCMTransparentInvertedColor: {
|
||||
QColor c(255-basecolor.red(), 255-basecolor.green(), 255-basecolor.blue(), basecolor.alpha());
|
||||
if (mode==JKQTPFFCMTransparentInvertedColor) c.setAlphaF(0.66*c.alphaF());
|
||||
return c;
|
||||
}
|
||||
case JKQTPFFCMLighterColor:
|
||||
case JKQTPFFCMLighterAndTransparentColor:{
|
||||
QColor c=basecolor.lighter();
|
||||
if (basecolor==QColor("black")) c=QColor(64,64,64);
|
||||
if (mode==JKQTPFFCMLighterAndTransparentColor) c.setAlphaF(0.66*c.alphaF());
|
||||
return c;
|
||||
}
|
||||
case JKQTPFFCMEvenLighterColor:
|
||||
case JKQTPFFCMEvenLighterAndTransparentColor: {
|
||||
QColor c=basecolor.lighter().lighter();
|
||||
if (basecolor==QColor("black")) c=QColor(127,127,127);
|
||||
if (mode==JKQTPFFCMEvenLighterAndTransparentColor) c.setAlphaF(0.66*c.alphaF());
|
||||
return c;
|
||||
}
|
||||
case JKQTPFFCMDarkerColor:
|
||||
case JKQTPFFCMDarkerAndTransparentColor: {
|
||||
QColor c=basecolor.darker();
|
||||
if (basecolor==QColor("white")) c= QColor(191,191,191);
|
||||
if (mode==JKQTPFFCMDarkerAndTransparentColor) c.setAlphaF(0.66*c.alphaF());
|
||||
return c;
|
||||
}
|
||||
case JKQTPFFCMEvenDarkerColor:
|
||||
case JKQTPFFCMEvenDarkerAndTransparentColor: {
|
||||
QColor c=basecolor.darker().darker();
|
||||
if (basecolor==QColor("white")) c= QColor(127,127,127);
|
||||
if (mode==JKQTPFFCMEvenDarkerAndTransparentColor) c.setAlphaF(0.66*c.alphaF());
|
||||
return c;
|
||||
}
|
||||
case JKQTPFFCMMoreTransparentColor: { QColor c=basecolor; c.setAlphaF(0.66*c.alphaF()); return c; }
|
||||
case JKQTPFFCMEvenMoreTransparentColor: { QColor c=basecolor; c.setAlphaF(0.33*c.alphaF()); return c; }
|
||||
case JKQTPFFCMLessTransparentColor: { QColor c=basecolor; c.setAlphaF(c.alphaF()+(1.0-c.alphaF())*0.33); return c; }
|
||||
|
@ -230,12 +230,22 @@ enum JKQTPColorDerivationMode {
|
||||
JKQTPFFCMGrey50, /*!< \brief fill with 50% grey */
|
||||
JKQTPFFCMGrey25, /*!< \brief fill with 25% grey */
|
||||
JKQTPFFCMWhite, /*!< \brief fill with white */
|
||||
JKQTPFFCMTransparentBlack, /*!< \brief fill with black, slightly transparent */
|
||||
JKQTPFFCMTransparentGrey75, /*!< \brief fill with 75% grey, slightly transparent */
|
||||
JKQTPFFCMTransparentGrey50, /*!< \brief fill with 50% grey, slightly transparent */
|
||||
JKQTPFFCMTransparentGrey25, /*!< \brief fill with 25% grey, slightly transparent */
|
||||
JKQTPFFCMTransparentWhite, /*!< \brief fill with white, slightly transparent */
|
||||
JKQTPFFCMSameColor, /*!< \brief fill with the same color */
|
||||
JKQTPFFCMInvertedColor, /*!< \brief fill with the inverted color */
|
||||
JKQTPFFCMTransparentInvertedColor, /*!< \brief fill with the inverted color, slightly transparent */
|
||||
JKQTPFFCMLighterColor, /*!< \brief fill with the a lighter color */
|
||||
JKQTPFFCMEvenLighterColor, /*!< \brief fill with the an even lighter color than JKQTPFFCMLighterColor */
|
||||
JKQTPFFCMDarkerColor, /*!< \brief fill with the a darker color */
|
||||
JKQTPFFCMEvenDarkerColor, /*!< \brief fill with the an even darker color than JKQTPFFCMDarkerColor */
|
||||
JKQTPFFCMLighterAndTransparentColor, /*!< \brief fill with the a lighter color, that is in addition a bit transparent */
|
||||
JKQTPFFCMEvenLighterAndTransparentColor, /*!< \brief fill with the an even lighter color than JKQTPFFCMLighterColor, that is in addition a bit transparent */
|
||||
JKQTPFFCMDarkerAndTransparentColor, /*!< \brief fill with the a darker color, that is in addition a bit transparent */
|
||||
JKQTPFFCMEvenDarkerAndTransparentColor, /*!< \brief fill with the an even darker color than JKQTPFFCMDarkerColor, that is in addition a bit transparent */
|
||||
JKQTPFFCMMoreTransparentColor, /*!< \brief fill with the a partly transparent color */
|
||||
JKQTPFFCMEvenMoreTransparentColor, /*!< \brief fill with the a more transparent color than JKQTPFFCMMoreTransparentColor */
|
||||
JKQTPFFCMLessTransparentColor, /*!< \brief fill with the a partly transparent color */
|
||||
|
Loading…
Reference in New Issue
Block a user