Panner Zoomer Scroll synchronization
Hi All,
I have a plot plugin and in this plot I have used panner zoomer and scroll too for kind of axes scale operation.
My question is what is the best way or is there any simple way to snchronize these kind of gadgets to control my scale ranges. Which signal do I follow for all gadgets to work in collaborative way?
Thanks in advance.
Re: Panner Zoomer Scroll synchronization
Well this is one of the parts where the design of the Qwt classes is week. The main problem is, that there are local zoom stacks ( local for each zoomer object ) but not a general navigation stack recording the history of all navigation operations.
Probably the best you can do is to modify the zoom stack ( zoomStack/setZoomStack ) manually in a slot connected to the panned signal of your panner.
Uwe
Re: Panner Zoomer Scroll synchronization
The QwtPlotPanner class has a "panned" signal and a "moveCanvas" slot, so you can synchronize scrolling on two panners as follows:
Code:
QObject::connect(panner1,
SIGNAL(panned
(int,
int)),panner2,
SLOT(moveCanvas
(int,
int)));
QObject::connect(panner2,
SIGNAL(panned
(int,
int)),panner1,
SLOT(moveCanvas
(int,
int)));
You could create a QwtLinkedPlotMagnifier class that derives from QwtPlotMagnifier to have similar slots and signals, and emit a resize_event() signal every time resize() is called:
Code:
{
Q_OBJECT
public:
protected:
virtual void rescale(double factor);
signals:
void rescale_event(double factor);
public slots:
void do_rescale(double factor);
};
QwtLinkedPlotMagnifier
::QwtLinkedPlotMagnifier(QwtPlotCanvas *canvas
) :{
}
void QwtLinkedPlotMagnifier::rescale(double factor){
emit rescale_event(factor);
}
void QwtLinkedPlotMagnifier::do_rescale(double factor){
}
Not sure about getting the qwt zoomer class to do what you want, though.