The QwtPlotPanner class has a "panned" signal and a "moveCanvas" slot, so you can synchronize scrolling on two panners as follows:
QObject::connect(panner1,
SIGNAL(panned
(int,
int)),panner2,
SLOT(moveCanvas
(int,
int)));
QObject::connect(panner2,
SIGNAL(panned
(int,
int)),panner1,
SLOT(moveCanvas
(int,
int)));
QObject::connect(panner1,SIGNAL(panned(int,int)),panner2,SLOT(moveCanvas(int,int)));
QObject::connect(panner2,SIGNAL(panned(int,int)),panner1,SLOT(moveCanvas(int,int)));
To copy to clipboard, switch view to plain text mode
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:
{
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){
}
class QwtLinkedPlotMagnifier : public QwtPlotMagnifier
{
Q_OBJECT
public:
explicit QwtLinkedPlotMagnifier(QwtPlotCanvas *canvas);
protected:
virtual void rescale(double factor);
signals:
void rescale_event(double factor);
public slots:
void do_rescale(double factor);
};
QwtLinkedPlotMagnifier::QwtLinkedPlotMagnifier(QwtPlotCanvas *canvas) :
QwtPlotMagnifier(canvas)
{
}
void QwtLinkedPlotMagnifier::rescale(double factor){
QwtPlotMagnifier::rescale(factor);
emit rescale_event(factor);
}
void QwtLinkedPlotMagnifier::do_rescale(double factor){
QwtPlotMagnifier::rescale(factor);
}
To copy to clipboard, switch view to plain text mode
Not sure about getting the qwt zoomer class to do what you want, though.
Bookmarks