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. help with SCXML state machine and special History state
Forum Updated to NodeBB v4.3 + New Features

help with SCXML state machine and special History state

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 1.4k Views 1 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.
  • P Offline
    P Offline
    pmh4514
    wrote on last edited by pmh4514
    #1

    Hello,

    I'm trying to wrap my head around the QScxmlStateMachine and the "history state" pseudo state. I just can't seem to get it to work as expected in a simple test-bed application. I'm using Qt 5.9 and Creator 4.3.1, MSVC2015 64bit.

    I visually created a simple parent state with a series of child states that transition from one to the next as the user does things. This much works just fine.

    I wanted to add a cancel+confirm type function, so outside of the parent state, I added a state called abortConfirm, and I created a transition from my parent state to it, called 'abort'.. I also added a "History" state as a child of the parent group (alongside the other child states) and from my 'abortConfirm' state, I added a transition to that history state, labeled 'abortDenied'

    When I click my 'cancel' button in my test GUI, I submitEvent('abort') to the state machine, it transitions as expected and I use a QMessageBox to ask 'are you sure?'.. From my qDebug logging I can see that the parent state is exited as I transition into my abortConfirm state.

    When the user clicks "Cancel" I then submitEvent('abortDenied') back to the state machine, which in the visual editor is tied to the History. I'd expect the "History" state to know which child state it was on at the time it received the 'abort' event, and return me to that state (as the dox say should happen). But it just doesn't seem to work.

    I know the SCXML editor is still "experimental" but should I expect the History state features to actually work?

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Hello! The history state can be either shallow or deep. shallow is the default but your descriptions reads as if you want it to be deep. See State Chart XML, 3.10.

      1 Reply Last reply
      3
      • P Offline
        P Offline
        pmh4514
        wrote on last edited by
        #3

        Hi!
        Thanks. I've tried both deep and shallow and I see no difference. As an aside (perhaps) I'm also wondering about the "Toggle Full Namespace" button - it does not change anything.. do I have to follow a specific naming convention for the child states for this to work?

        1 Reply Last reply
        0
        • P Offline
          P Offline
          pmh4514
          wrote on last edited by pmh4514
          #4

          I have found the problem, "history" state has nothing to do with it. Rather, I was performing my "Are you sure?" prompt (and submitting events based on the answer), inside the "steadyStateReached" handler, rather than posting an event from onEntry of the new state to trigger the "Are you sure?" prompt. Thus, none of my state transitions were happening out of that abortConfirm state. Now everything works as expected.

          1 Reply Last reply
          2

          • Login

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