Hi All,
First of all, Qwt is an excellent plot library. 
I met two issues when I'm trying upgrade qwt from 6.0.2 to 6.1.0.
1. X axis zoom only (see pic please). I overwritten drawRubberBand of QwtPlotZoomer. But it doens't work with Qwt-6.1.0.
zoomer.png
void TrendPlotZoomer
::drawRubberBand(QPainter* painter
) const {
const QPolygon pa
= adjustedPoints
(pickedPoints
());
if (pa.count() < 2)
return;
const QPoint& p1 = pa.first();
const QPoint& p2 = pa.last();
QRectF prect
= pickArea
().
boundingRect();
rect.setY(prect.y());
rect.setHeight(prect.height());
if (painter->pen().color() != Qt::color1) {
QColor color
= painter
->pen
().
color();
color.setAlpha(50);
painter->setBrush(color);
}
else {
painter->setBrush(painter->pen().color());
}
}
void TrendPlotZoomer::drawRubberBand(QPainter* painter) const
{
const QPolygon pa = adjustedPoints(pickedPoints());
if (pa.count() < 2)
return;
const QPoint& p1 = pa.first();
const QPoint& p2 = pa.last();
QRect rect = QRect(p1, p2).normalized();
QRectF prect = pickArea().boundingRect();
rect.setY(prect.y());
rect.setHeight(prect.height());
if (painter->pen().color() != Qt::color1) {
QColor color = painter->pen().color();
color.setAlpha(50);
painter->setBrush(color);
}
else {
painter->setBrush(painter->pen().color());
}
QwtPainter::drawRect(painter, rect);
}
To copy to clipboard, switch view to plain text mode
2. How to hide the frame line of canvas in 6.1.0?
With 6.0.2, I did like this:
canvas()->setLineWidth(0);
canvas
()->setFrameStyle
(QFrame::StyledPanel |
QFrame::Plain);
canvas()->setLineWidth(0);
canvas()->setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
To copy to clipboard, switch view to plain text mode
Althrough the canvas is an instance of QFrame, I want to how to turn off the frame line elegantly.
Bookmarks