mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-12-25 10:01:38 +08:00
changed backgroundColor-properties for plot/widget/key to backgroundBrush, modified example to demonstrate this
This commit is contained in:
parent
1064050b65
commit
3dc56510e9
@ -87,8 +87,19 @@ Finally two vertical barcharts with different filling options are added:
|
||||
linearG.setColorAt(1, cl12);
|
||||
linearG.setCoordinateMode(QGradient::ObjectMode);
|
||||
graphBF->setFillGradient(linearG);
|
||||
graphBF->setLineColor(Qt::transparent);```
|
||||
graphBF->setLineColor(Qt::transparent);
|
||||
```
|
||||
|
||||
In addition to the graph background properties, also the plot/widget/key backgrounds can be defined using a QBrush:
|
||||
|
||||
```.cpp
|
||||
// 7. set plot background with a gradient
|
||||
QLinearGradient backGrad(QPointF(0, 0), QPointF(1, 1));
|
||||
backGrad.setColorAt(0, QColor("salmon"));
|
||||
backGrad.setColorAt(1, QColor("white"));
|
||||
backGrad.setCoordinateMode(QGradient::ObjectMode);
|
||||
plot.getPlotter()->setPlotBackgroundGradient(backGrad);
|
||||
```
|
||||
|
||||
|
||||
The result looks like this:
|
||||
|
@ -138,17 +138,24 @@ int main(int argc, char* argv[])
|
||||
plot.addGraph(graphBE);
|
||||
plot.addGraph(graphBF);
|
||||
|
||||
// 7. set axis labels
|
||||
// 7. set plot background with a gradient
|
||||
QLinearGradient backGrad(QPointF(0, 0), QPointF(1, 1));
|
||||
backGrad.setColorAt(0, QColor("salmon"));
|
||||
backGrad.setColorAt(1, QColor("white"));
|
||||
backGrad.setCoordinateMode(QGradient::ObjectMode);
|
||||
plot.getPlotter()->setPlotBackgroundGradient(backGrad);
|
||||
|
||||
// 8. set axis labels
|
||||
plot.getXAxis()->setAxisLabel("x axis");
|
||||
plot.getYAxis()->setAxisLabel("y axis");
|
||||
plot.setGrid(true);
|
||||
plot.getPlotter()->setShowKey(false);
|
||||
|
||||
|
||||
// 8. scale plot automatically
|
||||
// 9. scale plot
|
||||
plot.setXY(0,11.9,-2.5,5.5);
|
||||
|
||||
// 9. show plotter and make it a decent size
|
||||
// 10. show plotter and make it a decent size
|
||||
plot.show();
|
||||
plot.resize(600,600);
|
||||
|
||||
|
@ -1079,18 +1079,13 @@ void JKQTBasePlotter::drawKey(JKQTPEnhancedPainter& painter) {
|
||||
// save old brushes and pens
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
QPen pf=painter.pen();
|
||||
QBrush bf=painter.brush();
|
||||
pf.setColor(plotterStyle.keyStyle.frameColor);
|
||||
pf.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, pt2px(painter, plotterStyle.keyStyle.frameWidth*lineWidthMultiplier)));
|
||||
pf.setStyle(Qt::SolidLine);
|
||||
bf.setColor(plotterStyle.keyStyle.backgroundColor);
|
||||
bf.setStyle(Qt::SolidPattern);
|
||||
painter.setBrush(bf);
|
||||
|
||||
painter.setBrush(plotterStyle.keyStyle.backgroundBrush);
|
||||
if (!plotterStyle.keyStyle.frameVisible) {
|
||||
QPen pff=pf;
|
||||
pff.setColor(plotterStyle.keyStyle.backgroundColor);
|
||||
pff.setWidthF(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH);
|
||||
painter.setPen(pff);
|
||||
painter.setPen(Qt::NoPen);
|
||||
} else {
|
||||
painter.setPen(pf);
|
||||
}
|
||||
@ -1149,8 +1144,8 @@ void JKQTBasePlotter::drawPlot(JKQTPEnhancedPainter& painter, bool showOverlays)
|
||||
// draw background
|
||||
{
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.setPen(plotterStyle.widgetBackgroundColor);
|
||||
if (plotterStyle.widgetBackgroundColor!=Qt::transparent) painter.fillRect(QRectF(0,0,widgetWidth/paintMagnification, widgetHeight/paintMagnification), QBrush(plotterStyle.widgetBackgroundColor));
|
||||
painter.setPen(Qt::NoPen);
|
||||
if (plotterStyle.widgetBackgroundBrush!=QBrush(Qt::transparent)) painter.fillRect(QRectF(0,0,widgetWidth/paintMagnification, widgetHeight/paintMagnification), plotterStyle.widgetBackgroundBrush);
|
||||
}
|
||||
QRectF rPlotBack(internalPlotBorderLeft, internalPlotBorderTop, internalPlotWidth, internalPlotHeight);
|
||||
painter.setRenderHint(JKQTPEnhancedPainter::NonCosmeticDefaultPen, true);
|
||||
@ -1161,7 +1156,7 @@ void JKQTBasePlotter::drawPlot(JKQTPEnhancedPainter& painter, bool showOverlays)
|
||||
QPen p(plotterStyle.plotFrameColor);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, pt2px(painter, plotterStyle.plotFrameWidth*lineWidthMultiplier)));
|
||||
painter.setPen(p);
|
||||
painter.setBrush(QBrush(plotterStyle.plotBackgroundColor));
|
||||
painter.setBrush(plotterStyle.plotBackgroundBrush);
|
||||
if (plotterStyle.plotFrameRounding<=0) {
|
||||
painter.drawRect(rPlotBack);
|
||||
} else {
|
||||
@ -1170,10 +1165,8 @@ void JKQTBasePlotter::drawPlot(JKQTPEnhancedPainter& painter, bool showOverlays)
|
||||
|
||||
} else {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.setBrush(QBrush(plotterStyle.plotBackgroundColor));
|
||||
QPen p(plotterStyle.plotBackgroundColor);
|
||||
p.setWidthF(0);
|
||||
painter.setPen(p);
|
||||
painter.setBrush(plotterStyle.plotBackgroundBrush);
|
||||
painter.setPen(Qt::NoPen);
|
||||
if (plotterStyle.plotFrameRounding<=0) {
|
||||
painter.drawRect(rPlotBack);
|
||||
} else {
|
||||
@ -1342,16 +1335,16 @@ void JKQTBasePlotter::gridPaint(JKQTPEnhancedPainter& painter, QSizeF pageRect,
|
||||
} else {
|
||||
|
||||
QList<double> fsm, lwm, pm;
|
||||
QList<QColor> backg;
|
||||
QList<QBrush> backg;
|
||||
for (int i=0; i< gridPrintingList.size(); i++) {
|
||||
fsm.append(gridPrintingList[i].plotter->getFontSizeMultiplier());
|
||||
lwm.append(gridPrintingList[i].plotter->getLineWidthMultiplier());
|
||||
pm.append(gridPrintingList[i].plotter->getPaintMagnification());
|
||||
backg.append(gridPrintingList[i].plotter->getExportBackgroundColor());
|
||||
backg.append(gridPrintingList[i].plotter->getExportBackgroundBrush());
|
||||
gridPrintingList[i].plotter->setFontSizeMultiplier(fontSizeMultiplier);
|
||||
gridPrintingList[i].plotter->setLineWidthMultiplier(lineWidthMultiplier);
|
||||
gridPrintingList[i].plotter->setPaintMagnification(paintMagnification);
|
||||
gridPrintingList[i].plotter->setBackgroundColor(gridPrintingList[i].plotter->getExportBackgroundColor());
|
||||
gridPrintingList[i].plotter->setBackgroundBrush(gridPrintingList[i].plotter->getExportBackgroundBrush());
|
||||
gridPrintingList[i].plotter->calcPlotScaling(painter);
|
||||
}
|
||||
gridPrintingCalc(); // ensure the grid plot has been calculated
|
||||
@ -1404,7 +1397,7 @@ void JKQTBasePlotter::gridPaint(JKQTPEnhancedPainter& painter, QSizeF pageRect,
|
||||
gridPrintingList[i].plotter->setFontSizeMultiplier(fsm[i]);
|
||||
gridPrintingList[i].plotter->setLineWidthMultiplier(lwm[i]);
|
||||
gridPrintingList[i].plotter->setPaintMagnification(pm[i]);
|
||||
gridPrintingList[i].plotter->setBackgroundColor(backg[i]);
|
||||
gridPrintingList[i].plotter->setBackgroundBrush(backg[i]);
|
||||
gridPrintingList[i].plotter->redrawPlot();
|
||||
}
|
||||
}
|
||||
@ -1517,8 +1510,8 @@ bool JKQTBasePlotter::printpreviewNew(QPaintDevice* paintDevice, bool setAbsolut
|
||||
double lw=lineWidthMultiplier;
|
||||
double fs=fontSizeMultiplier;
|
||||
double oldP=paintMagnification;
|
||||
QColor bc=plotterStyle.widgetBackgroundColor;
|
||||
plotterStyle.widgetBackgroundColor=plotterStyle.exportBackgroundColor;
|
||||
QBrush bc=plotterStyle.widgetBackgroundBrush;
|
||||
plotterStyle.widgetBackgroundBrush=plotterStyle.exportBackgroundBrush;
|
||||
lineWidthMultiplier=lineWidthPrintMultiplier;
|
||||
fontSizeMultiplier=fontSizePrintMultiplier;
|
||||
exportPreviewLabel=nullptr;
|
||||
@ -1722,7 +1715,7 @@ bool JKQTBasePlotter::printpreviewNew(QPaintDevice* paintDevice, bool setAbsolut
|
||||
printPreview=nullptr;
|
||||
lineWidthMultiplier=lw;
|
||||
fontSizeMultiplier=fs;
|
||||
plotterStyle.widgetBackgroundColor=bc;
|
||||
plotterStyle.widgetBackgroundBrush=bc;
|
||||
paintMagnification=oldP;
|
||||
|
||||
mathText.setUseUnparsed(false);
|
||||
@ -1925,8 +1918,8 @@ void JKQTBasePlotter::updatePreviewLabel() {
|
||||
void JKQTBasePlotter::printpreviewPaintRequested(QPrinter* printer) {
|
||||
double lw=lineWidthMultiplier;
|
||||
double fs=fontSizeMultiplier;
|
||||
QColor bc=plotterStyle.widgetBackgroundColor;
|
||||
plotterStyle.widgetBackgroundColor=plotterStyle.exportBackgroundColor;
|
||||
QBrush bc=plotterStyle.widgetBackgroundBrush;
|
||||
plotterStyle.widgetBackgroundBrush=plotterStyle.exportBackgroundBrush;
|
||||
lineWidthMultiplier=lineWidthPrintMultiplier;
|
||||
fontSizeMultiplier=fontSizePrintMultiplier;
|
||||
|
||||
@ -1993,7 +1986,7 @@ void JKQTBasePlotter::printpreviewPaintRequested(QPrinter* printer) {
|
||||
lineWidthMultiplier=lw;
|
||||
fontSizeMultiplier=fs;
|
||||
paintMagnification=oldpm;
|
||||
plotterStyle.widgetBackgroundColor=bc;
|
||||
plotterStyle.widgetBackgroundBrush=bc;
|
||||
|
||||
}
|
||||
|
||||
@ -2012,8 +2005,8 @@ void JKQTBasePlotter::printpreviewPaintRequestedNew(QPaintDevice *paintDevice)
|
||||
|
||||
double lw=lineWidthMultiplier;
|
||||
double fs=fontSizeMultiplier;
|
||||
QColor bc=plotterStyle.widgetBackgroundColor;
|
||||
plotterStyle.widgetBackgroundColor=plotterStyle.exportBackgroundColor;
|
||||
QBrush bc=plotterStyle.widgetBackgroundBrush;
|
||||
plotterStyle.widgetBackgroundBrush=plotterStyle.exportBackgroundBrush;
|
||||
lineWidthMultiplier=lineWidthPrintMultiplier;
|
||||
fontSizeMultiplier=fontSizePrintMultiplier;
|
||||
|
||||
@ -2095,14 +2088,14 @@ void JKQTBasePlotter::printpreviewPaintRequestedNew(QPaintDevice *paintDevice)
|
||||
lineWidthMultiplier=lw;
|
||||
fontSizeMultiplier=fs;
|
||||
paintMagnification=oldpm;
|
||||
plotterStyle.widgetBackgroundColor=bc;
|
||||
plotterStyle.widgetBackgroundBrush=bc;
|
||||
}
|
||||
|
||||
void JKQTBasePlotter::exportpreviewPaintRequested(JKQTPEnhancedPainter &painter, QSize size) {
|
||||
double lw=lineWidthMultiplier;
|
||||
double fs=fontSizeMultiplier;
|
||||
QColor bc=plotterStyle.widgetBackgroundColor;
|
||||
plotterStyle.widgetBackgroundColor=plotterStyle.exportBackgroundColor;
|
||||
QBrush bc=plotterStyle.widgetBackgroundBrush;
|
||||
plotterStyle.widgetBackgroundBrush=plotterStyle.exportBackgroundBrush;
|
||||
lineWidthMultiplier=lineWidthPrintMultiplier;
|
||||
fontSizeMultiplier=fontSizePrintMultiplier;
|
||||
bool oldEmitPlotSignals=emitPlotSignals;
|
||||
@ -2122,7 +2115,7 @@ void JKQTBasePlotter::exportpreviewPaintRequested(JKQTPEnhancedPainter &painter,
|
||||
emitPlotSignals=oldEmitPlotSignals;
|
||||
lineWidthMultiplier=lw;
|
||||
fontSizeMultiplier=fs;
|
||||
plotterStyle.widgetBackgroundColor=bc;
|
||||
plotterStyle.widgetBackgroundBrush=bc;
|
||||
}
|
||||
|
||||
void JKQTBasePlotter::printpreviewSetZoom(double value) {
|
||||
@ -2489,33 +2482,48 @@ double JKQTBasePlotter::getGraphWidth() const
|
||||
|
||||
void JKQTBasePlotter::setBackgroundColor(const QColor &__value)
|
||||
{
|
||||
if (this->plotterStyle.widgetBackgroundColor != __value) {
|
||||
this->plotterStyle.widgetBackgroundColor = __value;
|
||||
if (this->plotterStyle.widgetBackgroundBrush != QBrush(__value)) {
|
||||
this->plotterStyle.widgetBackgroundBrush=QBrush(__value);
|
||||
redrawPlot();
|
||||
}
|
||||
}
|
||||
|
||||
QColor JKQTBasePlotter::getBackgroundColor() const
|
||||
{
|
||||
return this->plotterStyle.widgetBackgroundColor;
|
||||
return this->plotterStyle.widgetBackgroundBrush.color();
|
||||
}
|
||||
|
||||
void JKQTBasePlotter::setExportBackgroundColor(const QColor &__value)
|
||||
{
|
||||
if (this->plotterStyle.exportBackgroundColor != __value) {
|
||||
this->plotterStyle.exportBackgroundColor = __value;
|
||||
if (this->plotterStyle.exportBackgroundBrush != QBrush(__value)) {
|
||||
this->plotterStyle.exportBackgroundBrush=QBrush(__value);
|
||||
redrawPlot();
|
||||
}
|
||||
}
|
||||
|
||||
QColor JKQTBasePlotter::getExportBackgroundColor() const
|
||||
{
|
||||
return this->plotterStyle.exportBackgroundColor;
|
||||
return this->plotterStyle.exportBackgroundBrush.color();
|
||||
}
|
||||
|
||||
QColor JKQTBasePlotter::getPlotBackgroundColor() const
|
||||
{
|
||||
return this->plotterStyle.plotBackgroundColor;
|
||||
return this->plotterStyle.plotBackgroundBrush.color();
|
||||
}
|
||||
|
||||
QBrush JKQTBasePlotter::getBackgroundBrush() const
|
||||
{
|
||||
return this->plotterStyle.widgetBackgroundBrush;
|
||||
}
|
||||
|
||||
QBrush JKQTBasePlotter::getExportBackgroundBrush() const
|
||||
{
|
||||
return this->plotterStyle.exportBackgroundBrush;
|
||||
}
|
||||
|
||||
QBrush JKQTBasePlotter::getPlotBackgroundBrush() const
|
||||
{
|
||||
return this->plotterStyle.plotBackgroundBrush;
|
||||
}
|
||||
|
||||
|
||||
@ -2703,14 +2711,47 @@ QColor JKQTBasePlotter::getKeyFrameColor() const
|
||||
return this->plotterStyle.keyStyle.frameColor;
|
||||
}
|
||||
|
||||
void JKQTBasePlotter::setKeyBackgroundColor(const QColor &__value)
|
||||
void JKQTBasePlotter::setKeyBackgroundColor(const QColor &__value, Qt::BrushStyle __style)
|
||||
{
|
||||
if (this->plotterStyle.keyStyle.backgroundColor != __value) {
|
||||
this->plotterStyle.keyStyle.backgroundColor = __value;
|
||||
if (this->plotterStyle.keyStyle.backgroundBrush != QBrush(__value, __style)) {
|
||||
this->plotterStyle.keyStyle.backgroundBrush = QBrush(__value, __style);
|
||||
redrawPlot();
|
||||
}
|
||||
}
|
||||
|
||||
void JKQTBasePlotter::setKeyBackgroundBrush(const QBrush &__value)
|
||||
{
|
||||
if (this->plotterStyle.keyStyle.backgroundBrush != __value) {
|
||||
this->plotterStyle.keyStyle.backgroundBrush = __value;
|
||||
redrawPlot();
|
||||
}
|
||||
}
|
||||
|
||||
void JKQTBasePlotter::setKeyBackgroundGradient(const QGradient &__value)
|
||||
{
|
||||
if (this->plotterStyle.keyStyle.backgroundBrush != QBrush(__value)) {
|
||||
this->plotterStyle.keyStyle.backgroundBrush = QBrush(__value);
|
||||
redrawPlot();
|
||||
}
|
||||
}
|
||||
|
||||
void JKQTBasePlotter::setKeyBackgroundTexture(const QImage &__value)
|
||||
{
|
||||
if (this->plotterStyle.keyStyle.backgroundBrush != QBrush(__value)) {
|
||||
this->plotterStyle.keyStyle.backgroundBrush = QBrush(__value);
|
||||
redrawPlot();
|
||||
}
|
||||
}
|
||||
|
||||
void JKQTBasePlotter::setKeyBackgroundTexture(const QPixmap &__value)
|
||||
{
|
||||
if (this->plotterStyle.keyStyle.backgroundBrush != QBrush(__value)) {
|
||||
this->plotterStyle.keyStyle.backgroundBrush = QBrush(__value);
|
||||
redrawPlot();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void JKQTBasePlotter::setKeyFrameWidth(double __value)
|
||||
{
|
||||
if (this->plotterStyle.keyStyle.frameWidth != __value) {
|
||||
@ -2856,13 +2897,115 @@ QString JKQTBasePlotter::getPlotLabel() const
|
||||
|
||||
QColor JKQTBasePlotter::getKeyBackgroundColor() const
|
||||
{
|
||||
return this->plotterStyle.keyStyle.backgroundColor;
|
||||
return this->plotterStyle.keyStyle.backgroundBrush.color();
|
||||
}
|
||||
|
||||
QBrush JKQTBasePlotter::getKeyBackgroundBrush() const
|
||||
{
|
||||
return this->plotterStyle.keyStyle.backgroundBrush;
|
||||
}
|
||||
|
||||
void JKQTBasePlotter::setPlotBackgroundColor(const QColor &__value)
|
||||
{
|
||||
if (this->plotterStyle.plotBackgroundColor != __value) {
|
||||
this->plotterStyle.plotBackgroundColor = __value;
|
||||
if (this->plotterStyle.plotBackgroundBrush != QBrush(__value)) {
|
||||
this->plotterStyle.plotBackgroundBrush=QBrush(__value);
|
||||
redrawPlot();
|
||||
}
|
||||
}
|
||||
|
||||
void JKQTBasePlotter::setBackgroundBrush(const QBrush &__value)
|
||||
{
|
||||
if (this->plotterStyle.widgetBackgroundBrush != (__value)) {
|
||||
this->plotterStyle.widgetBackgroundBrush=(__value);
|
||||
redrawPlot();
|
||||
}
|
||||
}
|
||||
|
||||
void JKQTBasePlotter::setExportBackgroundBrush(const QBrush &__value)
|
||||
{
|
||||
if (this->plotterStyle.exportBackgroundBrush != (__value)) {
|
||||
this->plotterStyle.exportBackgroundBrush=(__value);
|
||||
redrawPlot();
|
||||
}
|
||||
}
|
||||
|
||||
void JKQTBasePlotter::setPlotBackgroundBrush(const QBrush &__value)
|
||||
{
|
||||
if (this->plotterStyle.plotBackgroundBrush != (__value)) {
|
||||
this->plotterStyle.plotBackgroundBrush=(__value);
|
||||
redrawPlot();
|
||||
}
|
||||
}
|
||||
|
||||
void JKQTBasePlotter::setBackgroundGradient(const QGradient &__value)
|
||||
{
|
||||
if (this->plotterStyle.widgetBackgroundBrush != QBrush(__value)) {
|
||||
this->plotterStyle.widgetBackgroundBrush=QBrush(__value);
|
||||
redrawPlot();
|
||||
}
|
||||
}
|
||||
|
||||
void JKQTBasePlotter::setExportBackgroundGradient(const QGradient &__value)
|
||||
{
|
||||
if (this->plotterStyle.exportBackgroundBrush != QBrush(__value)) {
|
||||
this->plotterStyle.exportBackgroundBrush=QBrush(__value);
|
||||
redrawPlot();
|
||||
}
|
||||
}
|
||||
|
||||
void JKQTBasePlotter::setPlotBackgroundGradient(const QGradient &__value)
|
||||
{
|
||||
if (this->plotterStyle.plotBackgroundBrush != QBrush(__value)) {
|
||||
this->plotterStyle.plotBackgroundBrush=QBrush(__value);
|
||||
redrawPlot();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void JKQTBasePlotter::setBackgroundTexture(const QPixmap &__value)
|
||||
{
|
||||
if (this->plotterStyle.widgetBackgroundBrush != QBrush(__value)) {
|
||||
this->plotterStyle.widgetBackgroundBrush=QBrush(__value);
|
||||
redrawPlot();
|
||||
}
|
||||
}
|
||||
|
||||
void JKQTBasePlotter::setExportBackgroundTexture(const QPixmap &__value)
|
||||
{
|
||||
if (this->plotterStyle.exportBackgroundBrush != QBrush(__value)) {
|
||||
this->plotterStyle.exportBackgroundBrush=QBrush(__value);
|
||||
redrawPlot();
|
||||
}
|
||||
}
|
||||
|
||||
void JKQTBasePlotter::setPlotBackgroundTexture(const QPixmap &__value)
|
||||
{
|
||||
if (this->plotterStyle.plotBackgroundBrush != QBrush(__value)) {
|
||||
this->plotterStyle.plotBackgroundBrush=QBrush(__value);
|
||||
redrawPlot();
|
||||
}
|
||||
}
|
||||
|
||||
void JKQTBasePlotter::setBackgroundTexture(const QImage &__value)
|
||||
{
|
||||
if (this->plotterStyle.widgetBackgroundBrush != QBrush(__value)) {
|
||||
this->plotterStyle.widgetBackgroundBrush=QBrush(__value);
|
||||
redrawPlot();
|
||||
}
|
||||
}
|
||||
|
||||
void JKQTBasePlotter::setExportBackgroundTexture(const QImage &__value)
|
||||
{
|
||||
if (this->plotterStyle.exportBackgroundBrush != QBrush(__value)) {
|
||||
this->plotterStyle.exportBackgroundBrush=QBrush(__value);
|
||||
redrawPlot();
|
||||
}
|
||||
}
|
||||
|
||||
void JKQTBasePlotter::setPlotBackgroundTexture(const QImage &__value)
|
||||
{
|
||||
if (this->plotterStyle.plotBackgroundBrush != QBrush(__value)) {
|
||||
this->plotterStyle.plotBackgroundBrush=QBrush(__value);
|
||||
redrawPlot();
|
||||
}
|
||||
}
|
||||
|
@ -683,12 +683,18 @@ class JKQTP_LIB_EXPORT JKQTBasePlotter: public QObject {
|
||||
bool isUsingAntiAliasingForText() const;
|
||||
/** \copydoc JKQTBasePlotterStyle:defaultGraphWidth: */
|
||||
double getGraphWidth() const;
|
||||
/** \copydoc JKQTBasePlotterStyle::widgetBackgroundColor */
|
||||
/** \copydoc JKQTBasePlotterStyle::widgetBackgroundBrush */
|
||||
QColor getBackgroundColor() const;
|
||||
/** \copydoc JKQTBasePlotterStyle::exportBackgroundColor */
|
||||
/** \copydoc JKQTBasePlotterStyle::exportBackgroundBrush */
|
||||
QColor getExportBackgroundColor() const;
|
||||
/** \copydoc JKQTBasePlotterStyle::plotBackgroundColor */
|
||||
/** \copydoc JKQTBasePlotterStyle::plotBackgroundBrush */
|
||||
QColor getPlotBackgroundColor() const;
|
||||
/** \copydoc JKQTBasePlotterStyle::widgetBackgroundBrush */
|
||||
QBrush getBackgroundBrush() const;
|
||||
/** \copydoc JKQTBasePlotterStyle::exportBackgroundBrush */
|
||||
QBrush getExportBackgroundBrush() const;
|
||||
/** \copydoc JKQTBasePlotterStyle::plotBackgroundBrush */
|
||||
QBrush getPlotBackgroundBrush() const;
|
||||
/*! \copydoc JKQTPKeyStyle::fontSize */
|
||||
double getKeyFontSize() const;
|
||||
/*! \copydoc JKQTPKeyStyle::itemWidth */
|
||||
@ -715,8 +721,11 @@ class JKQTP_LIB_EXPORT JKQTBasePlotter: public QObject {
|
||||
bool getShowKeyFrame() const;
|
||||
/*! \copydoc JKQTPKeyStyle::frameColor */
|
||||
QColor getKeyFrameColor() const;
|
||||
/*! \copydoc JKQTPKeyStyle::backgroundColor */
|
||||
/*! \copydoc JKQTPKeyStyle::backgroundBrush */
|
||||
QColor getKeyBackgroundColor() const;
|
||||
/*! \copydoc JKQTPKeyStyle::backgroundBrush */
|
||||
QBrush getKeyBackgroundBrush() const;
|
||||
|
||||
/*! \copydoc JKQTPKeyStyle::textColor */
|
||||
QColor getKeyTextColor() const;
|
||||
/*! \copydoc JKQTPKeyStyle::frameWidth */
|
||||
@ -1611,12 +1620,36 @@ class JKQTP_LIB_EXPORT JKQTBasePlotter: public QObject {
|
||||
void setUseAntiAliasingForText(bool __value);
|
||||
/*! \copydoc JKQTBasePlotterStyle::defaultGraphWidth */
|
||||
void setGraphWidth(double __value);
|
||||
/*! \copydoc JKQTBasePlotterStyle::widgetBackgroundColor */
|
||||
/*! \copydoc JKQTBasePlotterStyle::widgetBackgroundBrush */
|
||||
void setBackgroundColor(const QColor & __value);
|
||||
/*! \copydoc JKQTBasePlotterStyle::exportBackgroundColor */
|
||||
/*! \copydoc JKQTBasePlotterStyle::exportBackgroundBrush */
|
||||
void setExportBackgroundColor(const QColor & __value);
|
||||
/*! \copydoc JKQTBasePlotterStyle::plotBackgroundColor */
|
||||
/*! \copydoc JKQTBasePlotterStyle::plotBackgroundBrush */
|
||||
void setPlotBackgroundColor(const QColor & __value);
|
||||
/*! \copydoc JKQTBasePlotterStyle::widgetBackgroundBrush */
|
||||
void setBackgroundBrush(const QBrush & __value);
|
||||
/*! \copydoc JKQTBasePlotterStyle::exportBackgroundBrush */
|
||||
void setExportBackgroundBrush(const QBrush & __value);
|
||||
/*! \copydoc JKQTBasePlotterStyle::plotBackgroundBrush */
|
||||
void setPlotBackgroundBrush(const QBrush & __value);
|
||||
/*! \copydoc JKQTBasePlotterStyle::widgetBackgroundBrush */
|
||||
void setBackgroundGradient(const QGradient & __value);
|
||||
/*! \copydoc JKQTBasePlotterStyle::exportBackgroundBrush */
|
||||
void setExportBackgroundGradient(const QGradient & __value);
|
||||
/*! \copydoc JKQTBasePlotterStyle::plotBackgroundBrush */
|
||||
void setPlotBackgroundGradient(const QGradient & __value);
|
||||
/*! \copydoc JKQTBasePlotterStyle::widgetBackgroundBrush */
|
||||
void setBackgroundTexture(const QPixmap & __value);
|
||||
/*! \copydoc JKQTBasePlotterStyle::exportBackgroundBrush */
|
||||
void setExportBackgroundTexture(const QPixmap & __value);
|
||||
/*! \copydoc JKQTBasePlotterStyle::plotBackgroundBrush */
|
||||
void setPlotBackgroundTexture(const QPixmap & __value);
|
||||
/*! \copydoc JKQTBasePlotterStyle::widgetBackgroundBrush */
|
||||
void setBackgroundTexture(const QImage & __value);
|
||||
/*! \copydoc JKQTBasePlotterStyle::exportBackgroundBrush */
|
||||
void setExportBackgroundTexture(const QImage & __value);
|
||||
/*! \copydoc JKQTBasePlotterStyle::plotBackgroundBrush */
|
||||
void setPlotBackgroundTexture(const QImage & __value);
|
||||
/*! \copydoc JKQTPKeyStyle::textColor */
|
||||
void setKeyTextColor(const QColor & __value);
|
||||
|
||||
@ -1657,8 +1690,16 @@ class JKQTP_LIB_EXPORT JKQTBasePlotter: public QObject {
|
||||
void setShowKeyFrame(bool __value);
|
||||
/*! \copydoc JKQTPKeyStyle::frameColor */
|
||||
void setKeyFrameColor(const QColor & __value);
|
||||
/*! \copydoc JKQTPKeyStyle::backgroundColor */
|
||||
void setKeyBackgroundColor(const QColor & __value);
|
||||
/*! \copydoc JKQTPKeyStyle::backgroundBrush */
|
||||
void setKeyBackgroundColor(const QColor & __value, Qt::BrushStyle __style);
|
||||
/*! \copydoc JKQTPKeyStyle::backgroundBrush */
|
||||
void setKeyBackgroundBrush(const QBrush & __value);
|
||||
/*! \copydoc JKQTPKeyStyle::backgroundBrush */
|
||||
void setKeyBackgroundGradient(const QGradient & __value);
|
||||
/*! \copydoc JKQTPKeyStyle::backgroundBrush */
|
||||
void setKeyBackgroundTexture(const QImage & __value);
|
||||
/*! \copydoc JKQTPKeyStyle::backgroundBrush */
|
||||
void setKeyBackgroundTexture(const QPixmap & __value);
|
||||
/*! \copydoc JKQTPKeyStyle::frameWidth */
|
||||
void setKeyFrameWidth(double __value);
|
||||
/*! \copydoc JKQTPKeyStyle::frameRounding */
|
||||
|
@ -15,9 +15,9 @@ JKQTBasePlotterStyle::JKQTBasePlotterStyle():
|
||||
defaultGraphWidth(2),
|
||||
defaultGraphSymbolSize(10),
|
||||
defaultGraphSymbolLineWidth(1),
|
||||
widgetBackgroundColor(QApplication::palette().color(QPalette::Window)),
|
||||
exportBackgroundColor(QColor("white")),
|
||||
plotBackgroundColor(QColor("white")),
|
||||
widgetBackgroundBrush(QApplication::palette().color(QPalette::Window)),
|
||||
exportBackgroundBrush(QColor("white")),
|
||||
plotBackgroundBrush(QColor("white")),
|
||||
plotFrameColor(QColor("black")),
|
||||
plotFrameWidth(2),
|
||||
plotFrameRounding(0),
|
||||
@ -69,9 +69,9 @@ void JKQTBasePlotterStyle::loadSettings(const QSettings &settings, const QString
|
||||
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();
|
||||
widgetBackgroundColor=jkqtp_String2QColor(settings.value(group+"widget_background_color", jkqtp_QColor2String(defaultStyle.widgetBackgroundColor)).toString());
|
||||
exportBackgroundColor=jkqtp_String2QColor(settings.value(group+"widget_background_color_for_export", jkqtp_QColor2String(defaultStyle.exportBackgroundColor)).toString());
|
||||
plotBackgroundColor=jkqtp_String2QColor(settings.value(group+"plot_background_color", jkqtp_QColor2String(defaultStyle.plotBackgroundColor)).toString());
|
||||
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()));
|
||||
plotFrameColor=jkqtp_String2QColor(settings.value(group+"plot_frame_color", jkqtp_QColor2String(defaultStyle.plotFrameColor)).toString());
|
||||
plotFrameWidth=settings.value(group+"plot_frame_width", defaultStyle.plotFrameWidth).toDouble();
|
||||
plotFrameVisible=settings.value(group+"plot_frame_visible", defaultStyle.plotFrameVisible).toBool();
|
||||
@ -171,9 +171,9 @@ void JKQTBasePlotterStyle::saveSettings(QSettings &settings, const QString &grou
|
||||
settings.setValue(group+"antialiase_system", useAntiAliasingForSystem);
|
||||
settings.setValue(group+"antialiase_graphs", useAntiAliasingForGraphs);
|
||||
settings.setValue(group+"antialiase_text", useAntiAliasingForText);
|
||||
settings.setValue(group+"widget_background_color", jkqtp_QColor2String(widgetBackgroundColor));
|
||||
settings.setValue(group+"widget_background_color_for_export", jkqtp_QColor2String(exportBackgroundColor));
|
||||
settings.setValue(group+"plot_background_color", jkqtp_QColor2String(plotBackgroundColor));
|
||||
settings.setValue(group+"widget_background_color", jkqtp_QColor2String(widgetBackgroundBrush.color()));
|
||||
settings.setValue(group+"widget_background_color_for_export", jkqtp_QColor2String(exportBackgroundBrush.color()));
|
||||
settings.setValue(group+"plot_background_color", jkqtp_QColor2String(plotBackgroundBrush.color()));
|
||||
settings.setValue(group+"plot_border_left", plotBorderLeft);
|
||||
settings.setValue(group+"plot_border_right", plotBorderRight);
|
||||
settings.setValue(group+"plot_border_top", plotBorderTop);
|
||||
|
@ -111,11 +111,11 @@ class JKQTP_LIB_EXPORT JKQTBasePlotterStyle {
|
||||
/** \brief with (in pt) of symbol lines used for newly added graphs */
|
||||
double defaultGraphSymbolLineWidth;
|
||||
/** \brief color of the background of the plot (widget area) when drawing (to the screen) */
|
||||
QColor widgetBackgroundColor;
|
||||
QBrush widgetBackgroundBrush;
|
||||
/** \brief color of the background of the plot (widget area) when exporting*/
|
||||
QColor exportBackgroundColor;
|
||||
QBrush exportBackgroundBrush;
|
||||
/** \brief color of the plot's background (i.e. of the area within the coordinate axes rectangle) */
|
||||
QColor plotBackgroundColor;
|
||||
QBrush plotBackgroundBrush;
|
||||
/** \brief if \c plotFrameVisible==true, JKQTBasePlotter will draw a rectangle/frame around the plot in this color */
|
||||
QColor plotFrameColor;
|
||||
/** \brief if \c plotFrameVisible==true, JKQTBasePlotter will draw a rectangle/frame around the plot in this width [pt] */
|
||||
|
@ -62,7 +62,7 @@ JKQTPGraph::JKQTPGraph(JKQTPlotter *parent):
|
||||
QImage JKQTPPlotElement::generateKeyMarker(QSize size)
|
||||
{
|
||||
QImage img(size.width(),size.height(),QImage::Format_ARGB32);
|
||||
if (parent) img.fill(parent->getKeyBackgroundColor());
|
||||
if (parent) img.fill(Qt::transparent);//->getKeyBackgroundColor());
|
||||
{
|
||||
JKQTPEnhancedPainter painter(&img);
|
||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||
|
@ -27,7 +27,7 @@ JKQTPKeyStyle::JKQTPKeyStyle():
|
||||
frameColor(QColor("black")),
|
||||
frameWidth(1),
|
||||
frameRounding(0),
|
||||
backgroundColor(QColor("white")),
|
||||
backgroundBrush(QColor("white")),
|
||||
visible(true),
|
||||
fontSize(9),
|
||||
textColor(QColor("black")),
|
||||
@ -69,7 +69,7 @@ void JKQTPKeyStyle::loadSettings(const QSettings &settings, const QString &group
|
||||
frameWidth = settings.value(group+"frame_width", defaultStyle.frameWidth).toDouble();
|
||||
frameRounding = settings.value(group+"frame_rounding", defaultStyle.frameRounding).toDouble();
|
||||
frameVisible = settings.value(group+"frame_visible", defaultStyle.frameVisible).toBool();
|
||||
backgroundColor = jkqtp_String2QColor(settings.value(group+"background_color", jkqtp_QColor2String(defaultStyle.backgroundColor)).toString());
|
||||
backgroundBrush = QBrush(jkqtp_String2QColor(settings.value(group+"background_color", jkqtp_QColor2String(defaultStyle.backgroundBrush.color())).toString()));
|
||||
visible = settings.value(group+"visible", defaultStyle.visible).toBool();
|
||||
position = String2JKQTPKeyPosition(settings.value(group+"position", JKQTPKeyPosition2String(defaultStyle.position)).toString());
|
||||
layout = String2JKQTPKeyLayout(settings.value(group+"layout", JKQTPKeyLayout2String(defaultStyle.layout)).toString());
|
||||
@ -92,7 +92,7 @@ void JKQTPKeyStyle::saveSettings(QSettings &settings, const QString &group) cons
|
||||
settings.setValue(group+"frame_color", jkqtp_QColor2String(frameColor));
|
||||
settings.setValue(group+"frame_width", frameWidth);
|
||||
settings.setValue(group+"frame_rounding", frameRounding);
|
||||
settings.setValue(group+"background_color", jkqtp_QColor2String(backgroundColor));
|
||||
settings.setValue(group+"background_color", jkqtp_QColor2String(backgroundBrush.color()));
|
||||
settings.setValue(group+"visible", visible);
|
||||
settings.setValue(group+"position", JKQTPKeyPosition2String(position));
|
||||
settings.setValue(group+"layout", JKQTPKeyLayout2String(layout));
|
||||
|
@ -66,7 +66,7 @@ class JKQTP_LIB_EXPORT JKQTPKeyStyle {
|
||||
/** \brief rounding radius of the key frame rectangle (<=0 -> no rounded rectangle) [pt] */
|
||||
double frameRounding;
|
||||
/** \brief color of the key background */
|
||||
QColor backgroundColor;
|
||||
QBrush backgroundBrush;
|
||||
/** \brief indicates whether to plot a key */
|
||||
bool visible;
|
||||
/** \brief font size for key labels [in points] */
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 89 KiB After Width: | Height: | Size: 121 KiB |
Binary file not shown.
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 28 KiB |
Loading…
Reference in New Issue
Block a user