Lefsler
Lefsler

Reputation: 1768

Add mouse click event to QGraphicsView created with QtCreator

Is there a way to create a event to the QGraphicsView created without creating another class and inheriting the QGraphicsView? I want to know if there's a way to do something like that:

ui->gView->AddEvent(click, functionName);

Thanks.

Upvotes: 2

Views: 2490

Answers (1)

Stephen Chu
Stephen Chu

Reputation: 12832

If you want to handle mouse click event for the view, install an event filter to the view and watch for MouseButtonPress event.

Upvotes: 2

Related Questions