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 and SCXML
Qt 6.11 is out! See what's new in the release blog

QStateMachine and SCXML

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.1k 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.
  • E Offline
    E Offline
    ericrosevear
    wrote on last edited by
    #1

    Hello,

    I am using the latest version of the QT SDK and qscxml and am trying to create a custom invoker with some sample code from the web page "Using SCXML files in Qt". The documentation appears to be out of date. The code does not compile (see below).

    Could someone point me in the right direction?

    Thanks,

    Eric

    @
    #include <QtScriptedStateMachine>

     class MyInvoker : public QtSsmInvoker
     {
         Q_OBJECT
         public:
             MyInvoker(QtScriptedEvent* ievent, QtScriptedStateMachine* p) : QtSsmInvoker(ievent,p),menu(0)
             {
             }
             static void initInvokerFactory(QtScriptedStateMachine* machine)
             {
                 machine->scriptEngine()->globalObject().setProperty("some-name",someValue);
             }
             static bool isTypeSupported (const QString & s) { return s== "my-type"; }
         public Q_SLOTS:
             void activate ()
             {
                 doSomeStuff ();
             }
     };
    

    ...
    static QSsmAutoInvokerFactory<MyInvoker> _s_factory;
    myScriptedStateMachine->registerInvoker(&_s_factory);
    @

    [Edit: Added @ code tags. Also split into a new thread. -- mlong]

    1 Reply Last reply
    0
    • E Offline
      E Offline
      ericrosevear
      wrote on last edited by
      #2

      Update: Solved this problem by emulating the default invoker.

      Another question:

      I would like to ask how can I access an qscxml global from either my main or from the invoker?

      They are created as private globals as follows
      @
      QScriptValue glob = pvt->scriptEng->globalObject();
      glob.setProperty("_data",pvt->scriptEng->newObject());
      glob.setProperty("_global",pvt->scriptEng->globalObject());
      @

      Thanks,

      Eric

      [Edit: Added @ tags -- mlong]

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

        Hi, Eric, welcome to Devnet!

        Please be sure to wrap your code snippets in @ tags for formatting. Also, please open new threads for additional topics/questions. Thanks, and welcome again!

        Software Engineer
        My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

        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