Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Get QGraphicsScene from QGraphicsRectItem
Qt 6.11 is out! See what's new in the release blog

Get QGraphicsScene from QGraphicsRectItem

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 360 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Please_Help_me_DP Offline
    Please_Help_me_DP Offline
    Please_Help_me_D
    wrote on last edited by
    #1

    Hi,

    I have QGraphicsView and add QGraphicsScene and there I have QGraphicsRectItem :)
    So I implement mouseDoubleClickEvent in my class inherited from QGraphicsRectItem (when I double click on rectangle item I go to the fuction myClass::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event))
    How to get QGraphicsScene object and QGraphicsView widget when being in the 'mouseDoubleClickEvent' function?
    Pointer this is the plotted rectangle.

    JonBJ 1 Reply Last reply
    0
    • Please_Help_me_DP Please_Help_me_D

      Hi,

      I have QGraphicsView and add QGraphicsScene and there I have QGraphicsRectItem :)
      So I implement mouseDoubleClickEvent in my class inherited from QGraphicsRectItem (when I double click on rectangle item I go to the fuction myClass::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event))
      How to get QGraphicsScene object and QGraphicsView widget when being in the 'mouseDoubleClickEvent' function?
      Pointer this is the plotted rectangle.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @Please_Help_me_D

      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.

      Please_Help_me_DP 1 Reply Last reply
      2
      • JonBJ JonB

        @Please_Help_me_D

        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.

        Please_Help_me_DP Offline
        Please_Help_me_DP Offline
        Please_Help_me_D
        wrote on last edited by
        #3

        @JonB Thank you, that worked!

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved