Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
state property is empty
AndreAhmed last edited by
I'm trying to add to qstatemachine a property with string and an enum, but the result from the machine.property() is empty.
idle->assignProperty(m_machine, "state", Z_IDLE); cool->assignProperty(m_machine, "state", Z_COOL); start_z->assignProperty(m_machine, "state", Z_START); QVariant st = m_machine->property("state"); QString s = st.toString();
"Instructs this state to set the property with the given name of the given object to the given value when the state is entered."
Note the "when the state is entered."
Im not sure your m_machine has enter any of the state before
the st.toString() part ?
Unless you entered one of these states, there's no reason of the property to be set on m_machine.