Hi,

i have a little problem with QwtWheel and how to update it's values related to a x-Axis that continuously changes.

Subclass MasterWheel from QwtWheel

When scaleDivChanged() signal was triggered, i apply the changes to the MasterWheel.
When valueChanged(double) signal was triggered, i apply the new values from MasterWheel to the axis

The problem:
-> when scaleDivChanged() i apply the new values to the MasterWheel (only if it is not in use)
-> i set also the value to the lowerBound() of the QwtScaleDiv
-> BUT, when the value is changed i got the signal to change the axis
-> if i apply the new value to axis, i trigger the signal scaleDivChanged() and so on...

now i have a circle of signals and slots

How to set the values of a QwtWheel if the xBottom changes continuously?

Thx
Stefan

Here is my code:

Qt Code:
  1. connect( pPlotPressure->axisWidget( QwtPlot::xBottom ), SIGNAL(scaleDivChanged()), SLOT(setMasterWheelValues()));
  2. connect( pMasterWheel, SIGNAL(valueChanged(double)), SLOT(setAxisScaleByMasterWheel(double)));
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. void PlotManager::setMasterWheelValues()
  2. {
  3. // wheelPressed() set isActive() to true
  4. // wheelReleased() set isActive() to false
  5. if( !(pMasterWheel->isActive()) )
  6. {
  7. const QwtScaleDiv scaleDiv = pPlotPressure->axisScaleDiv( QwtPlot::xBottom );
  8. const double minValue = scaleDiv.lowerBound();
  9. const double maxValue = scaleDiv.upperBound();
  10.  
  11. if( maxValue > pMasterWheel->maximum() )
  12. pMasterWheel->setMaximum( maxValue );
  13. if( minValue < pMasterWheel->minimum() )
  14. pMasterWheel->setMinimum( minValue );
  15.  
  16. // pMasterWheel->setValue( minValue ); // THIS LINE IS THE PROBLEM
  17.  
  18. d_data->dxMasterWheel = scaleDiv.range();
  19. }
  20. }
  21.  
  22. void PlotManager::setAxisScaleByMasterWheel(double value)
  23. {
  24. pPlotPressure->setAxisScale( QwtPlot::xBottom, value, value + d_data->dxMasterWheel );
  25. pPlotPressure->replot();
  26. }
To copy to clipboard, switch view to plain text mode