Solved state property is empty
-
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();
-
hi
http://doc.qt.io/qt-5/qstate.html#assignProperty
"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 ? -
Hi,
Unless you entered one of these states, there's no reason of the property to be set on m_machine.