Results 1 to 4 of 4

Thread: Cannot assign to non-existent property - QtObject

  1. #1
    Join Date
    Apr 2011
    Posts
    216
    Thanks
    136
    Thanked 6 Times in 5 Posts

    Default Cannot assign to non-existent property - QtObject

    Qt Code:
    1. import QtQuick 2.0
    2.  
    3. Item
    4. {
    5. id : mainWindow
    6. width : 1024
    7. height : 768
    8.  
    9. QtObject
    10. {
    11. id: anisha
    12. property url theme;
    13. }
    14.  
    15. anisha.theme: "ddsad";
    16. }
    To copy to clipboard, switch view to plain text mode 
    Error:

    Qt Code:
    1. Cannot assign to non-existent property "anisha"
    2. anisha.theme: "ddsad";
    To copy to clipboard, switch view to plain text mode 

    What is the way to use QtObject?

  2. #2
    Join Date
    Apr 2011
    Posts
    216
    Thanks
    136
    Thanked 6 Times in 5 Posts

    Default Re: Cannot assign to non-existent property - QtObject

    Okay, the problem was that I hadn't placed statement `anisha.theme` inside any QML object.
    So, when I do:

    Text { text: anisha.theme } , it works as expected.

  3. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Cannot assign to non-existent property - QtObject

    Did you remove the line -
    Qt Code:
    1. anisha.theme: "ddsad";
    To copy to clipboard, switch view to plain text mode 
    ??

    You are trying to use the initialization format while assigning value to the property.

    This should work -
    Qt Code:
    1. anisha.theme = "ddsad";
    To copy to clipboard, switch view to plain text mode 

  4. The following user says thank you to aamer4yu for this useful post:

    TheIndependentAquarius (23rd December 2013)

  5. #4
    Join Date
    Apr 2011
    Posts
    216
    Thanks
    136
    Thanked 6 Times in 5 Posts

    Default Re: Cannot assign to non-existent property - QtObject

    I did realize that lately. Yes, that was also a problem. Thanks.

Similar Threads

  1. Cannot assign to non-existent property "lon" lon: "3"
    By TheIndependentAquarius in forum Qt Quick
    Replies: 1
    Last Post: 12th November 2013, 15:50
  2. Error: Cannot assign to non-existent property
    By ustulation in forum Qt Quick
    Replies: 8
    Last Post: 3rd July 2013, 13:54
  3. Replies: 1
    Last Post: 8th September 2012, 05:56
  4. QFileDialog 'Save As' to non-existent directory
    By mclark in forum Qt Programming
    Replies: 2
    Last Post: 9th September 2010, 22:32
  5. delete QtObject
    By Lodhart in forum Newbie
    Replies: 2
    Last Post: 22nd December 2009, 08:15

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.