Results 1 to 3 of 3

Thread: Scripting question

  1. #1
    Join Date
    Oct 2007
    Location
    Quebec, Canada
    Posts
    40
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Scripting question

    I try to use Qt Script module to trigger some slots in my application for testing purpose and I have a slot which takes a QVector<QVariant> as arguments. My question is how can I send these parameters from the script ?

    I tried this script:

    Qt Code:
    1. var myArray = ["String", 0];
    2. myObject.mySlot(myArray);
    To copy to clipboard, switch view to plain text mode 

    Then my slot gets called but the QVector is empty.

    I tried Q_DECLARE_METATYPE(QVector<QVariant>) and qScriptRegisterSequenceMetaType<QVector<QVariant> >(engine) and I can't even compile it. I get this error :

    error C2039: 'qt_metatype_id' : is not a member of 'QMetaTypeId<T>'
    with
    [
    T=QVariant
    ]
    How can I do this ?
    Last edited by jpn; 31st January 2008 at 20:26. Reason: reformatted to look better

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Scripting question

    Use QVariantList. It's an alias for QList<QVariant>.

  3. #3
    Join Date
    Oct 2007
    Location
    Quebec, Canada
    Posts
    40
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Scripting question

    I should have updated it yesterday. That's what I finally did.

Similar Threads

  1. Access to QSqlTableModel::isDirty Question.
    By patrik08 in forum Qt Programming
    Replies: 3
    Last Post: 12th April 2007, 17:49
  2. Replies: 1
    Last Post: 15th March 2007, 20:45
  3. Question regarding how to paint after zoom.
    By JonathanForQT4 in forum Qt Programming
    Replies: 2
    Last Post: 26th January 2007, 15:34
  4. QThread exit()/quit() question
    By TheKedge in forum Qt Programming
    Replies: 1
    Last Post: 28th August 2006, 14:38

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.