QGraphicsitem emits signal when selected / unselected?

Can anyone provide some hint for a simple way to get the signal emitted when a QGraphicsitem is selected / unselected every time?

+3


source to share


1 answer


You can use itemChange () to get notified about this (or emit your own signal if you really need it from there):

QVariant QGraphicsItem :: itemChange (change GraphicsItemChange, const QVariant and value) [virtual protected]



more or less similar (pseudocode)

QVariant QGraphicsItemSubclass::itemChange( GraphicsItemChange change, 
                                                 const QVariant &value ) {
    if ( change == QGraphicsItem::ItemSelectedChange ) {
        if (value == true) {
          // Handling selection.. / selection emission

      

+3


source







All Articles