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. QStateMachine, scxml, custom states questions

QStateMachine, scxml, custom states questions

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 504 Views
  • 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.
  • M Offline
    M Offline
    MrShawn
    wrote on last edited by
    #1

    I am getting into the state machine framework and I have a couple questions.

    From what I've read the State machine runs in its own event loop, to make use of that I need a custom state (inheret from QState) and overwrite on entry method. Is this correct? Also can I implement a custom state like that using scxml? The scxml editor is very nice for quickly defining the state machine structure but I feel I am losing a lot of potential control over making the state machine programatically. In order to get c++ functionality into my state machine I connect event signals and slots, in which case the code is ran in my ui event loop - not what I want (this is using the scxml state machine that was generated).

    I tried looking around to find how to work with the qt state machine, I saw a lot of really simple examples but everything focuses on transitions and different state types. The best example of doing some work doesn't make use of scxml (it says inherent the QState and override which I don't believe I can do with the scxml generated state machine). If anyone has some pointers on how to best use the state machine and implementing c++ code i would be glad to hear it. I need to use c++ for a few reasons , DB connectivity, and hardware interfacing.

    Thanks

    1 Reply Last reply
    0
    • W Offline
      W Offline
      wpmccormick
      wrote on last edited by
      #2

      I'm starting down the Scxml road. It's unfortunate you never got answers to your questions here, but did you ever get some answers elsewhere or figure things out to the point you're still on this road?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MrShawn
        wrote on last edited by
        #3

        I don't tend to use the SCXML anymore. I just use the C++ framework and build my state machine in code. I tend to inherit QState with a BaseState class implementation that I can used to define base functionality with certain signals / slots and usually have access to a shared pointer which contains state machine data. From there I inherit the BaseState and apply the state specific logic.

        For prototyping state machine structure I tend to use the draw.io app which is a little less clunky than the SCXML editor.

        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