Results 1 to 4 of 4

Thread: problem with setting properties in creating dynamic objects

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2011
    Location
    Pearl of the Orient Seas
    Posts
    40
    Thanks
    12
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows Symbian S60 Maemo/MeeGo

    Question problem with setting properties in creating dynamic objects

    Hi,

    Can someone help me regarding the creation of dynamic objects in QML?

    I followed the example on this link http://doc.qt.nokia.com/4.7-snapshot...icobjects.html cause I wanted to create something similar.

    I created the example as is ( Sprite.qml and main.qml ), as well as the javascript file.
    javascript Code:
    1. var component;
    2. var sprite;
    3.  
    4. function createSpriteObjects() {
    5. component = Qt.createComponent("Sprite.qml");
    6. if (component.status == Component.Ready)
    7. finishCreation();
    8. else
    9. component.statusChanged.connect(finishCreation);
    10. }
    11.  
    12. function finishCreation() {
    13. if (component.status == Component.Ready) {
    14. sprite = component.createObject(appWindow, {"x": 100, "y": 100});
    15. if (sprite == null) {
    16. // Error Handling
    17. console.log("Error creating object");
    18. }
    19. } else if (component.status == Component.Error) {
    20. // Error Handling
    21. console.log("Error loading component:", component.errorString());
    22. }
    23. }
    To copy to clipboard, switch view to plain text mode 

    Works fine but the setting of properties x and y on line 14 does not work.

    Is this a bug, or is there something I'm missing? Thank you for your help!
    Last edited by wysota; 20th August 2011 at 13:19.

Similar Threads

  1. how to set unknown number of dynamic properties
    By rashmi in forum Qt Programming
    Replies: 0
    Last Post: 15th March 2011, 09:07
  2. Replies: 1
    Last Post: 20th January 2011, 17:17
  3. QUiLoader Problem: No Dynamic Properties Support
    By kalli in forum Qt Programming
    Replies: 0
    Last Post: 28th June 2010, 21:51
  4. dynamic properties
    By Hogwarts in forum Qt Programming
    Replies: 1
    Last Post: 3rd May 2010, 16:37
  5. How avoid translation of dynamic properties
    By thomas_-_s in forum Qt Tools
    Replies: 1
    Last Post: 19th October 2008, 22:02

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.