I am using the Zoomer example from stockchart in my own plot example.
When I right click on the plot, it sets the xScale back to 0 even though my plot is on autoscale and my x-axis is larger than 0.
This is the zoomer code I'm using:
class Zoomer: public QwtPlotZoomer
{
public:
Zoomer( QWidget *canvas, bool trackerMode ):
QwtPlotZoomer( canvas )
{
setRubberBandPen( QColor( Qt::darkGreen ) );
setTrackerMode( trackerMode == true ? QwtPlotPicker::AlwaysOn : QwtPlotPicker::AlwaysOff );
}
protected:
virtual QwtText trackerTextF( const QPointF &pos ) const
{
QwtText text( QString("%1 , %2").arg(QString::number(pos.x()), QString::number(pos.y())) );
text.setColor( Qt::white );
QColor c = rubberBandPen().color();
text.setBorderPen( QPen( c ) );
text.setBorderRadius( 6 );
c.setAlpha( 170 );
text.setBackgroundBrush( c );
return text;
}
};
// LeftButton for the zooming
// RightButton: zoom out by 1
// Ctrl+RighButton: zoom out to full size
// TODO: when the user right clicks on plot, the data dissapears
zoomer = new Zoomer( canvas, fields.displayTracker );
zoomer->setMousePattern( QwtEventPattern::MouseSelect2,
Qt::RightButton, Qt::ControlModifier );
zoomer->setMousePattern( QwtEventPattern::MouseSelect3,
Qt::RightButton );
Has anyone experienced this before or know what could be happening?
Thanks.
Bookmarks