Results 1 to 2 of 2

Thread: Save list of QVariantList(which has came from QT) into global variable in QML

  1. #1
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Save list of QVariantList(which has came from QT) into global variable in QML

    Hi,
    I am sending list of QVariantList to qml as a single variable and i get this list correctly in qml. But when i want to save this list in a global variable in qml i have a problem . It won’t save as list and it seems that it converts to a single variable. How can i save it as a array or list in qml which is 2D????
    I have defined my property in qml as follows:
    property variant pAlarmsList : [];

    I am using Qt 5.1 and QTQuick 2.1

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Save list of QVariantList(which has came from QT) into global variable in QML

    If by "sending to QML" you mean that you get it from C++, how do you do that?

    Since you say you want it as a global variable, it sounds a lot like something a context property or a property on an exported QObject instance would do nicely.

    Cheers,
    _

Similar Threads

  1. a QSettings global variable
    By ilpaso in forum Qt Programming
    Replies: 4
    Last Post: 20th February 2011, 15:20
  2. Replies: 0
    Last Post: 16th May 2010, 18:53
  3. Setting a global variable
    By Windsoarer in forum Qt Programming
    Replies: 3
    Last Post: 16th February 2010, 23:37
  4. how to declare a global variable right
    By Cruz in forum Newbie
    Replies: 13
    Last Post: 16th February 2010, 17:25
  5. global variable
    By Shuchi Agrawal in forum General Programming
    Replies: 10
    Last Post: 15th February 2007, 05:19

Tags for this Thread

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.