QState assignProperty and object pointer lifetime



  • Hi,

    Can anyone tell me how QState's assignProperty(QObject *, const char *, const QVariant &) method handles objects that are no longer in scope?

    For example, I would like to set the enabled property of a button in a QDialog from the global state machine in my application. The assignProperty(button, "enabled", false) statement is executed every time the dialog is opened, as the dialog is newly instantiated every time. The issue is, that with the above statement active, my application sometimes crashes after opening the dialog a few times. It seems that assignProperty() is sometimes still trying to set the property of the already deleted previous buttons. Could this be possible? If so, is there a way to remove an assignProperty() instruction from a state without deleting and recreating the entire state?

    Thanks


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.