Results 1 to 7 of 7

Thread: Storing property lists for custom designer plugins

  1. #1
    Join Date
    Nov 2006
    Location
    Dresden, Germany
    Posts
    108
    Thanks
    9
    Thanked 12 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Storing property lists for custom designer plugins

    Hi there,

    I have a class with a list of objects. The objects can be edited in my designer plugin. For instance, a list with integer values:
    Qt Code:
    1. QList<int> m_intlist;
    To copy to clipboard, switch view to plain text mode 

    Now I declare this list as a property:

    Qt Code:
    1. Q_PROPERTY(QList<int> intList READ intList WRITE setIntList DESIGNABLE true)
    To copy to clipboard, switch view to plain text mode 

    But even if I change the properties at design time, the values get never stored in the ui file. Does anyone know a solution to this?

    Also, I have more complex data types of form QList<SomeClass> and also want to store this data in the ui file? Do I have to overload some xml generating functions or how does the designer know how to convert the object data into proper XML code for the ui file?

    Bye
    Andreas

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Storing property lists for custom designer plugins

    Would you mind explainig how do you edit a list through designer property editor?
    I mean, I can see how you can asign a value to one member of the list, but how do you asign several values to the same list?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    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: Storing property lists for custom designer plugins

    Have you tried adding a "STORED true" statement to the property declaration?

  4. #4
    Join Date
    Nov 2006
    Location
    Dresden, Germany
    Posts
    108
    Thanks
    9
    Thanked 12 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question Re: Storing property lists for custom designer plugins

    high_flyer: I created a custom designer widget extension that opens a dialog where I can edit my property lists

    wysota: yes, tried that. Doesn't make a difference. Seems that Qt Designer simply ignores properties that do not have a default editor mode (for the property list) assigned - or worded differently, designer ignores properties it cannot handle.

    Now, I would like to append my own customized XML code the code that designer creates when saving a widget. But I cannot find any function in QObject that I could overload for that purpose or otherwise add that additional XML information.

    Any idea?

    PS: The best solution I have so far is to write the data into an XML document and store this as a plain string property... but this looks really messy in the ui file and can probably be considered a "hack"...
    Andreas

  5. #5
    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: Storing property lists for custom designer plugins

    Try changing QList<int> into QVariantList, there is a high chance Qt will handle the rest.

  6. #6
    Join Date
    Nov 2006
    Location
    Dresden, Germany
    Posts
    108
    Thanks
    9
    Thanked 12 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Storing property lists for custom designer plugins

    Nope, doesn't work :-(
    Data in QVariantList is also not written to the ui file...

    Does anyone know how Qt handles the ui writing internally? Is it taking the information from the metadata? If so, is there any way to overload a function of the metaobject?
    Andreas

  7. #7
    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: Storing property lists for custom designer plugins

    Does your extension mark the property as changed in the property sheet? Maybe the problem is not in writing the property but in that the Designer doesn't know it has to store it... You can verify that by changing the list type again to QStringList as the UI saver handles that nicely. If it doesn't work then it means the problem is elsewhere.

Similar Threads

  1. Replies: 15
    Last Post: 25th March 2007, 03:40
  2. Arthur Plugins demos and designer
    By antonio.r.tome in forum Installation and Deployment
    Replies: 4
    Last Post: 21st March 2006, 14:01
  3. QPixmap designer property not showing up
    By high_flyer in forum Qt Programming
    Replies: 1
    Last Post: 15th March 2006, 19:56
  4. custom plugin designer property with out a variable?
    By high_flyer in forum Qt Programming
    Replies: 1
    Last Post: 15th March 2006, 19:11

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.