Results 1 to 1 of 1

Thread: ListElement cannot use script for property value in ListElement (QML)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2010
    Posts
    8
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Maemo/MeeGo

    Default ListElement cannot use script for property value in ListElement (QML)

    Hello,
    I am trying to update the values of roles in ListElement.
    Here is my Example.qml file
    Qt Code:
    1. Item{
    2.  
    3. property string title :""
    4. property string tags: ""
    5. property string name: ""
    6.  
    7. }
    To copy to clipboard, switch view to plain text mode 

    Here is myModel.qml

    Qt Code:
    1. ListModel{
    2.  
    3. ListElement{source: myExample.tags }
    4.  
    5. }
    To copy to clipboard, switch view to plain text mode 




    and here is the main.qml
    Qt Code:
    1. Rectangle {
    2. width: 600
    3. height: 600
    4. Text {
    5. x: 66
    6. y: 93
    7. text: "Hello World"
    8. }
    9.  
    10.  
    11. Example{id:myExample}
    12.  
    13. }
    To copy to clipboard, switch view to plain text mode 

    What I am not allowed to do above is to use "myExample.tags" as the value of role of a ListElement. The error is the following:

    ListElement: cannot use script for property value
    ListElement{source: myExample.tags }
    Is there any other way to update the roles inside the ListModel?
    Is it possible to create a ListModel in C++ and use it in QML as plugin?
    Last edited by magpielover; 22nd April 2011 at 11:31.

Similar Threads

  1. qt script property
    By wookoon in forum Qt Programming
    Replies: 2
    Last Post: 28th September 2010, 11:41
  2. script
    By wookoon in forum Newbie
    Replies: 1
    Last Post: 19th July 2010, 10:47
  3. Qt Script
    By c_srikanth1984 in forum Qt Programming
    Replies: 3
    Last Post: 9th June 2009, 11:35
  4. Can I include a script from script?
    By yycking in forum Qt Programming
    Replies: 1
    Last Post: 24th April 2009, 04:01
  5. Qt script
    By rajesh_clt3 in forum Qt Programming
    Replies: 2
    Last Post: 27th July 2007, 13:40

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.