virtual void
int style,
int from,
int to) const
{
QwtPlotCurve::drawCurve(painter, style, xMap, yMap, from, to
);
return;
}
switch (curveType()) {
case Xfy :
topLeft.rx() = xMap.transform(baseline());
topLeft.ry() = yMap.transform(y(from));
bottomRight.rx() = xMap.transform(maxXValue());
bottomRight.ry() = yMap.transform(y(to));
break;
case Yfx :
topLeft.rx() = xMap.transform(x(from));
topLeft.ry() = yMap.transform(baseline());
bottomRight.rx() = xMap.transform(x(to));
bottomRight.ry() = yMap.transform(maxYValue());
break;
}
painter->save();
painter
->drawRect
(QRect(topLeft, bottomRight
));
// Draw clip rectangle painter
->setClipRect
(QRect(topLeft, bottomRight
));
const QPen savedPen
= painter
->pen
();
painter->setPen(Qt::transparent);
painter->setPen(savedPen);
const QBrush savedBrush
= painter
->brush
();
painter->setBrush(Qt::NoBrush);
painter->setBrush(savedBrush);
painter->restore();
}
virtual void
drawCurve(QPainter *painter,
int style,
const QwtScaleMap &xMap,
const QwtScaleMap &yMap,
int from,
int to) const
{
if (style < QwtPlotCurve::UserCurve) {
QwtPlotCurve::drawCurve(painter, style, xMap, yMap, from, to);
return;
}
QPoint topLeft;
QPoint bottomRight;
switch (curveType()) {
case Xfy :
topLeft.rx() = xMap.transform(baseline());
topLeft.ry() = yMap.transform(y(from));
bottomRight.rx() = xMap.transform(maxXValue());
bottomRight.ry() = yMap.transform(y(to));
break;
case Yfx :
topLeft.rx() = xMap.transform(x(from));
topLeft.ry() = yMap.transform(baseline());
bottomRight.rx() = xMap.transform(x(to));
bottomRight.ry() = yMap.transform(maxYValue());
break;
}
painter->save();
painter->drawRect(QRect(topLeft, bottomRight)); // Draw clip rectangle
painter->setClipRect(QRect(topLeft, bottomRight));
const QPen savedPen = painter->pen();
painter->setPen(Qt::transparent);
QwtPlotCurve::drawLines(painter, xMap, yMap, from, to);
painter->setPen(savedPen);
const QBrush savedBrush = painter->brush();
painter->setBrush(Qt::NoBrush);
QwtPlotCurve::drawLines(painter, xMap, yMap, from, to);
painter->setBrush(savedBrush);
painter->restore();
}
To copy to clipboard, switch view to plain text mode
Bookmarks