Uwe, thanks for your recommendation. I've worked on it a bit. It seems to work. But in certain cases it doesn't. I've uploaded the plotmatrix.cpp file I modified here: https://gist.github.com/hyOzd/4e3e9f...ff3c57efb9dc56
Let me explain. When I zoom in to one of the plots for the first time, in the first or second row left scales are updated correctly. But third row isn't updated correctly. When I continue zooming deeper, third row is updated correctly and it works fine for all levels. When I unzoom with right click, third row again isn't updated properly. When third row is out of sync, changing the window size fixes the problem. But I've noticed that changing window size should result in a size change in the leftmost plot widget, otherwise it isn't effective.
By the way here is the ZoomGroup class I've added to sync zoom stacks of plot widgets (also present in above gist):
{
private:
bool inSync = false;
void onZoomed
(const QRectF &rect
) {
if (inSync)
{
qDebug() << "in sync";
return;
}
inSync = true;
Q_ASSERT(source != NULL);
for (int i = 0; i < zoomers.length(); i++)
{
if (source == zoomers[i])
continue;
zoomers[i]->setZoomStack(source->zoomStack(),
source->zoomRectIndex());
}
inSync = false;
}
public:
{
connect(
zoomer, &QwtPlotZoomer::zoomed,
this, &ZoomGroup::onZoomed,
Qt::QueuedConnection);
zoomers.append(zoomer);
}
private:
QList<QwtPlotZoomer*> zoomers;
};
class ZoomGroup : public QObject
{
private:
bool inSync = false;
void onZoomed(const QRectF &rect)
{
if (inSync)
{
qDebug() << "in sync";
return;
}
inSync = true;
QwtPlotZoomer* source = qobject_cast<QwtPlotZoomer*>(sender());
Q_ASSERT(source != NULL);
for (int i = 0; i < zoomers.length(); i++)
{
if (source == zoomers[i])
continue;
zoomers[i]->setZoomStack(source->zoomStack(),
source->zoomRectIndex());
}
inSync = false;
}
public:
void addZoomer(QwtPlotZoomer* zoomer)
{
connect(
zoomer, &QwtPlotZoomer::zoomed,
this, &ZoomGroup::onZoomed,
Qt::QueuedConnection);
zoomers.append(zoomer);
}
private:
QList<QwtPlotZoomer*> zoomers;
};
To copy to clipboard, switch view to plain text mode
Bookmarks