Solved Get QGraphicsScene from QGraphicsRectItem
-
Hi,
I have
QGraphicsView
and addQGraphicsScene
and there I haveQGraphicsRectItem
:)
So I implementmouseDoubleClickEvent
in 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?
Pointerthis
is 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!