Hello,
I've created a class that inherits from QwtPlot, and then added a slot connected to a signal caught at mouse drag/move events:
{
public:
UI ( ) : ...
{
...
_pickerMachine = std::make_shared<QwtPickerDragPointMachine>();
_picker->setStateMachine( _pickerMachine.get() );
connect( _picker.
get(),
SIGNAL ( moved
( QPoint ) ),
this,
SLOT ( callback
( QPoint ) ) );
...
}
public slots:
void callback
( QPoint point
) {
std::cout << "move callback to: " << point.x() << "," << point.y() << std::endl;
}
private:
...
}
class UI : public QwtPlot
{
public:
UI ( ) : ...
{
...
_pickerMachine = std::make_shared<QwtPickerDragPointMachine>();
_picker->setStateMachine( _pickerMachine.get() );
connect( _picker.get(), SIGNAL ( moved ( QPoint ) ), this, SLOT ( callback ( QPoint ) ) );
...
}
public slots:
void callback ( QPoint point )
{
std::cout << "move callback to: " << point.x() << "," << point.y() << std::endl;
}
private:
...
}
To copy to clipboard, switch view to plain text mode
I understand that I can ask for a replot, although I'm not sure how. Been searching for a few hours but couldn't find much info.
My callback does get signaled the position of the mouse click, how can I move the plot to use as center the QPoint where the mouse click occured?
Bookmarks