Hello,

I'm trying to do two movable cursors, I already get one done however I'm having problems for the second one.

I read an old post suggesting to use signalMapper.

So my code for one cursor stay in this way:

Connection
Qt Code:
  1. connect(d_picker, SIGNAL(moved(QPoint)),this,SLOT(function_b(QPoint)));
To copy to clipboard, switch view to plain text mode 

Function B
Qt Code:
  1. void Plot::function_b(QPoint actualMousePosition)
  2. {
  3. int x = curve->closestPoint(actualMousePosition,NULL);
  4. QPointF Position = curve->sample(x);
  5. d_marker->setValue(Position);
  6. this->replot();
  7. }
To copy to clipboard, switch view to plain text mode 


Now for do two cursor using signalMapper:

Qt Code:
  1. signalMapper = new QSignalMapper( this );
  2.  
  3. connect( d_picker, SIGNAL(moved(QPoint)), signalMapper, SLOT(map()) );
  4. connect( d_picker1, SIGNAL(moved(QPoint)), signalMapper, SLOT(map()) );
  5.  
  6. signalMapper->setMapping( d_picker, d_picker );
  7.  
  8. signalMapper->setMapping( d_picker1, d_picker1 );
  9.  
  10. connect( signalMapper, SIGNAL(mapped(QObject*)), this,SLOT(mover(QObject*)) );
To copy to clipboard, switch view to plain text mode 


My question is, how to handle the mouse position? I already tried d_picker->trackerPosition(); inside of mover but didn't work.
And I already read old post but they was moving two cursors at same time, and I need move separately


Someone can give some idea to how to proceed ?