Reputation: 41
I have some experience with QWT doing some small test programs, but now I need to make something that is professional.
I have a plot where I need to do zooming and panning. I install a zoomer which works great and add a panner, but when I pan the zoomed area the replot works fine at the end of the panning, but during the movement I just have the image from the last replot which moves around and on the sides I have blank images. Is there anyway that I can have it display a continual updating image while it moves (something like goggle maps)? I realize that google maps is just a jpg image so it is not the same, but it would look much cleaner if I could do this. Thanks.
Upvotes: 4
Views: 1547
Reputation: 148
This might work...
class CustomPanner: public QwtPlotPanner
{
public:
explicit CustomPanner(QWidget* parent) : QwtPlotPanner(parent){}
virtual bool eventFilter( QObject * object, QEvent * event)
{
if ( object == NULL || object != parentWidget() )
return false;
switch ( event->type() )
{
case QEvent::MouseButtonPress:
{
widgetMousePressEvent( static_cast<QMouseEvent *>( event ) );
break;
}
case QEvent::MouseMove:
{
QMouseEvent * evr = static_cast<QMouseEvent *>( event );
widgetMouseMoveEvent( evr );
widgetMouseReleaseEvent( evr );
setMouseButton(evr->button(), evr->modifiers());
widgetMousePressEvent( evr);
break;
}
case QEvent::MouseButtonRelease:
{
QMouseEvent * evr = static_cast<QMouseEvent *>( event );
widgetMouseReleaseEvent( static_cast<QMouseEvent *>( event ) );
break;
grab();
}
case QEvent::KeyPress:
{
widgetKeyPressEvent( static_cast<QKeyEvent *>( event ) );
break;
}
case QEvent::KeyRelease:
{
widgetKeyReleaseEvent( static_cast<QKeyEvent *>( event ) );
break;
}
case QEvent::Paint:
{
if ( isVisible() )
return true;
break;
}
default:;
}
return false;
}
};
Now use tihs instead of PlotPanner
Upvotes: 2