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. Removing QStates from a QState
Forum Updated to NodeBB v4.3 + New Features

Removing QStates from a QState

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 690 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
    AccWhid
    wrote on last edited by
    #1

    I have a need when using QStateMachine to dynamically create a number of identical substates to represent a looping action. I do this by creating a list of states and setting up their transitions when I am in the onEntry event in the QState. When I exit the state via onExit I delete the states I created. These dynamic states are transitioned to and from via permenant states in the QState

    Is this safe to do? I know QStateMachine has a removeState method, and the documentation states to try to avoid doing this while the machine is running, but is this only for top level states? Is deleting the QStates safe?

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

      Hi,

      Can you explain why that looping action needs these "dynamic states" ?

      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
      • A Offline
        A Offline
        AccWhid
        wrote on last edited by
        #3

        After extensive testing I discovered this is not safe. I will just use a flag to determine how many more times I need to loop through a state.

        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