QtScript: how using typedef enum as slot parameter in QtScript



  • I want to call a slot of a class by a QtScript. But this slot has a typedef enum as parameter. I cannot figure out, how this will work.

    I have something like this:
    @
    typedef enum
    {
    A = 0x02
    B = 0x03
    } MyVersion;

    ...

    class Something : public QObject
    {
    ...
    public slot:
    void setVersion( MyVersion vNumber);
    }
    @

    Now I want to call that slot 'setVersion' in QtScript like:
    @
    //QtScript call 1
    MyScriptSomething.setVersion( A );
    @

    or at least:
    @
    //QtScript call 2
    MyScriptSomething.setVersion( 2 );
    @

    All I ever tried gave me the errors
    QtScript call 1: "ReferenceError: Can't find variable: A"
    QtScript call 2: "TypeError: Incompatible type of argument(s) in call to setVersion(); candidates were setVersion(MyVersion)"


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.