Get QGraphicsScene from QGraphicsRectItem
-
Hi,
I have
QGraphicsViewand addQGraphicsSceneand there I haveQGraphicsRectItem:)
So I implementmouseDoubleClickEventin my class inherited fromQGraphicsRectItem(when I double click on rectangle item I go to the fuctionmyClass::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event))
How to get QGraphicsScene object and QGraphicsView widget when being in the 'mouseDoubleClickEvent' function?
Pointerthisis the plotted rectangle. -
Hi,
I have
QGraphicsViewand addQGraphicsSceneand there I haveQGraphicsRectItem:)
So I implementmouseDoubleClickEventin my class inherited fromQGraphicsRectItem(when I double click on rectangle item I go to the fuctionmyClass::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event))
How to get QGraphicsScene object and QGraphicsView widget when being in the 'mouseDoubleClickEvent' function?
Pointerthisis the plotted rectangle.Get QGraphicsScene from QGraphicsRectItem
QGraphicsScene *QGraphicsItem::scene() const, https://doc.qt.io/qt-5/qgraphicsitem.html#scene.QList<QGraphicsView *> QGraphicsScene::views() const, https://doc.qt.io/qt-5/qgraphicsscene.html#views. -
Get QGraphicsScene from QGraphicsRectItem
QGraphicsScene *QGraphicsItem::scene() const, https://doc.qt.io/qt-5/qgraphicsitem.html#scene.QList<QGraphicsView *> QGraphicsScene::views() const, https://doc.qt.io/qt-5/qgraphicsscene.html#views.@JonB Thank you, that worked!