Results 1 to 3 of 3

Thread: Design patterns for dynamic GUI building

  1. #1
    Join Date
    Feb 2008
    Posts
    40
    Thanks
    9
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Design patterns for dynamic GUI building

    I would like to ask, if you know any solid design pattern for dynamic gui creation. Description of user interface is kept in a xml file and a simple model is created basing on this description. Then a GUI (mostly a form, but with a few additional custom-made widgets) should be built from this model.

    Right now every part of the model and the model itself (each part represent usually represent some kind of a input field) has getWidget method, which calls a factory that returns properly built widget. Model recursively calls its parts and returns whole, large widget. I don't like it, because model knows something about the GUI, which isn't something I would like to have. On the other hand, I just can't iterate through objects, because I would need to ask for a type of every part of the model - that sucks too. And I even can't cheat a little and use overloading, since it's python. What's more when I use external factory I don't have all the information about the editor which will keep the input widgets. I thought about giving the editor functions, that will add input widgets to itself, but this just doesn't seem right.

    Did anyone do such thing and has observations or know any good solutions to this problem?
    Last edited by gruszczy; 17th July 2008 at 20:39.

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Design patterns for dynamic GUI building


  3. #3
    Join Date
    Feb 2008
    Posts
    40
    Thanks
    9
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Design patterns for dynamic GUI building

    I'd rather use some more generic design, that depend on entirely on qt solution. I might need to add code for different GUI library. That's why I would like to use some less concrete design, that I can easily implement with other libs.

    Anyony tried such thing or knows how to do this?

    EDIT: OK, I think I'll just use a Visitor and treat editor itself as visitor walking through the model.
    Last edited by gruszczy; 18th July 2008 at 11:44.

Similar Threads

  1. Replies: 10
    Last Post: 2nd December 2010, 07:10
  2. Design Patterns in Qt
    By bits in forum General Discussion
    Replies: 11
    Last Post: 11th May 2007, 09:13

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.