I'm using a QwtPlot based on one of the samples, with multiple curves.
When my QwtCurve is configured with a aliceblue color pen, I don't see the curve (this does not reproduce with other colors).
Would be hard to put in all the code that draws the points but here is the color related part:
Relevant header:
//! Collection of all curves in plot
//! Collection of all curves in plot
QMap<QString, QwtPlotCurve*> mCurves;
To copy to clipboard, switch view to plain text mode
Code in constructor:
setAutoReplot(false);
//! No caching
#if defined(Q_WS_X11)
// Even if not recommended by TrollTech, Qt::WA_PaintOutsidePaintEvent
// works on X11. This has a nice effect on the performance.
canvas()->setAttribute(Qt::WA_PaintOutsidePaintEvent, true);
canvas()->setAttribute(Qt::WA_PaintOnScreen, true);
#endif
plotLayout()->setAlignCanvasToScales(true);
grid
->setPen
(QPen(Qt
::gray,
0.0, Qt
::DotLine));
grid->enableX(true);
grid->enableXMin(true);
grid->enableY(true);
grid->enableYMin(false);
grid->attach(this);
for (int i = 0; i < objectsToPlot.count(); i++)
{
currCurve
->setPen
(QPen(objectsToPlot.
at(i
).
color));
// Here: color is aliceBlue currCurve
->setRenderHint
(QwtPlotItem::RenderAntialiased,
true);
currCurve
->setPaintAttribute
(QwtPlotCurve::ClipPolygons,
false);
currCurve->setZ(i);
currCurve->setData(new QwtPointSeriesData());
currCurve->attach(this);
mCurves.insert(objectsToPlot.at(i).combinedIndex, currCurve);
}
setAutoReplot(false);
//! No caching
canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false);
#if defined(Q_WS_X11)
// Even if not recommended by TrollTech, Qt::WA_PaintOutsidePaintEvent
// works on X11. This has a nice effect on the performance.
canvas()->setAttribute(Qt::WA_PaintOutsidePaintEvent, true);
canvas()->setAttribute(Qt::WA_PaintOnScreen, true);
#endif
plotLayout()->setAlignCanvasToScales(true);
QwtPlotGrid *grid = new QwtPlotGrid();
grid->setPen(QPen(Qt::gray, 0.0, Qt::DotLine));
grid->enableX(true);
grid->enableXMin(true);
grid->enableY(true);
grid->enableYMin(false);
grid->attach(this);
for (int i = 0; i < objectsToPlot.count(); i++)
{
QwtPlotCurve *currCurve = new QwtPlotCurve(objectsToPlot.at(i).combinedIndex);
currCurve->setStyle(QwtPlotCurve::Lines);
currCurve->setPen(QPen(objectsToPlot.at(i).color)); // Here: color is aliceBlue
currCurve->setRenderHint(QwtPlotItem::RenderAntialiased, true);
currCurve->setPaintAttribute(QwtPlotCurve::ClipPolygons, false);
currCurve->setZ(i);
currCurve->setData(new QwtPointSeriesData());
currCurve->attach(this);
mCurves.insert(objectsToPlot.at(i).combinedIndex, currCurve);
}
To copy to clipboard, switch view to plain text mode
Bookmarks