Search code examples
qtmouseclick-eventqgraphicsscene

how to set accessible name for a QGraphicsScene?


I'm using QT. I want to set accessible name for a QGraphicsScene because at the mouse click I want to check whether witch graphics scene has been clicked? Thank You


Solution

  • Each class that is derived from QObject(including QGraphicsScene) has following function to set a name for it:

    void setObjectName ( const QString & name )
    

    And you can retrieve this name with this function:

    QString objectName () const