Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. state property is empty

state property is empty

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 3 Posters 636 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AndreAhmed
    wrote on last edited by
    #1

    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();
    
    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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 ?

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        Unless you entered one of these states, there's no reason of the property to be set on m_machine.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved