Two graphs with same x axis and zoom stacks
Brought to you by:
rathmann
From: Денис С. <si...@g-...> - 2013-10-14 13:22:55
|
Hello. There are two graph windows in the program which need to have the same x axis and the same zoom stacks. http://imgur.com/g44kP0q There should be a possibility of zooming in or out any graph. When zooming a graph, the other graph should adjust it's x axis and zoom stack to be the same as the graph which was zoomed. So if I have zoomed in one of the graphs 3 times, there should be a possibility of zooming out the other graph 3 times too. If after this I zoom in the second graph, there should be a possibility of zooming out both graphs 4 times. I'm trying to do this with QwtPlotZoomer::setZoomStack method. It works fine when zooming in but it does not work when zooming out. When zooming out, the second graph does not change. The slotZoom method is connected to the 'zoomed' signal of graph's QwtPlotZoomer. The 'in_slot' variable is used to avoid recursive calls of the slot. connect(ui.g_signal1->zoomer(), SIGNAL(zoomed()), this, SLOT(slotZoom())); connect(ui.g_signal2->zoomer(), SIGNAL(zoomed()), this, SLOT(slotZoom())); void MainForm::slotZoom() { QString sname=sender()->objectName(); if(sname=="Signal1") { if(in_slot)return; in_slot=true; ui.g_signal2->zoomer()->setZoomStack(ui.g_signal1->zoomer()->zoomStack()); in_slot=false; } if(sname=="Signal2") { if(in_slot)return; in_slot=true; ui.g_signal1->zoomer()->setZoomStack(ui.g_signal2->zoomer()->zoomStack()); in_slot=false; } } What is wrong in this code? What can be the correct solution? Best regards, Denis |