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. QtScript: how using typedef enum as slot parameter in QtScript
Forum Updated to NodeBB v4.3 + New Features

QtScript: how using typedef enum as slot parameter in QtScript

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.7k 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.
  • J Offline
    J Offline
    JSchmidt
    wrote on last edited by
    #1

    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)"

    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