Disabling Wheel Event in a QGraphicsView ?
Solved
General and Desktop
-
As there is no property to enable or disable it you have to create a subclass and overwrite the implementation of the corresponding
wheelEvent()
. Something along the lines of:class MyGraphicsView : public QGraphicsView { Q_OBJECT public: explicit MyGraphicsView(QWidget* parent = nullptr) : QGraphicsView(parent) {} protected: virtual void wheelEvent(QWheelEvent* event) Q_DECL_OVERRIDE { event->accept(); } };
-
Thanks for this unique answer .
Actually , i figured out myself an another solution :
void Scene::wheelEvent(QGraphicsSceneWheelEvent *event) { event->accept(); }
Probably not as good , so i'll use yours .
topic->setAsSolved(true);
-
@Walux said:
Probably not as good , so i'll use yours .
just for clarification:
Actually this is exactly the same approach, just a step later.
(After the graphics view translated and forwarded it's received events to it's scene).