Results 1 to 5 of 5

Thread: Why does Designer alter my UI upon Save/Load?

  1. #1
    Join Date
    Sep 2006
    Posts
    19
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Why does Designer alter my UI upon Save/Load?

    I have been using Designer for a few days and notice that upon saving an interface, Designer will replace all my layouts with widgets and start malfunctioning.


    What I am doing:

    I create a new main window form, place a square frame and beneath it two small tool buttons both of the same minimum and maximum size to prevent them from resizing, I also put a horizontal sizer next to them. I mark all four widgets and put them in a grid layout and change its spacing to 0 to pack the widgets neatly together.

    At this point everything is fine, I can see the red frame of the layout and it will move and resize the widgets within as expected. I then save the form, quit Designer, start it up again and load the form.

    Now, looking in the object inspector window, what used to be my "<noname> QGridlayout" has now been replaced by a "Widget QWidget", still grouping my widgets inside and functioning as a grid layout, however it is not displaying its red frame and I am not able to break the layout. If I delete this new grouping widget and its children, its layout effect will sometimes persist, and creating a new widget in the main window will make it size and position as if the entire window itself was a grid layout, eventhough I did not perform that step.


    How do I resolve this? I am using the precompiled Qt Designer in the 4.1.4 Open Source package under Windows XP SP2.
    Last edited by ZB; 17th September 2006 at 12:18.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Why does Designer alter my UI upon Save/Load?

    You can't leave layouts floating around. This was even more strictly prevented in earlier designer versions. It was impossible to save a form which had floating layouts. The behaviour was changed recently. Nowadays a wrapper widget is created just to set the floating layout to.

    Try setting a top level layout for the designed form instead of just selecting those 4 particular widgets and layouting them into a floating layout. A top level layout can be set for example through the context menu from main window's background ("Lay out" -> "Lay Out in a grid").
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    ZB (17th September 2006)

  4. #3
    Join Date
    Sep 2006
    Posts
    19
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Why does Designer alter my UI upon Save/Load?

    Thanks, I found this solution too.

    I hope the Qt team will change this since not performing these steps stops you from conveniently saving your UI for working at it at a later time. Forgetting to do this leaves you with no choice but picking the contained widgets and moving them outside manually and "re-layouting" it all again, since you can't break the grouping widget or "empty" it of controls, which also would be a very useful function.

    Thanks
    Last edited by ZB; 17th September 2006 at 22:36.

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Why does Designer alter my UI upon Save/Load?


  6. #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: Why does Designer alter my UI upon Save/Load?

    Quote Originally Posted by ZB View Post
    Thanks, I found this solution too.

    I hope the Qt team will change this since not performing these steps stops you from conveniently saving your UI for working at it at a later time.
    On the other hand, if the layout was left "floating", it would produce an invalid file (and I guess it is good if a graphical editor produces only valid files). An easy (and probably good) solution is to always use a top level layout. The truth is -- if you don't use a top level layout, you don't need lower level layouts, so it might be a good idea to just get rid of one of the floating layouts in favour of the top level layout. And using a top level layout even if you're not done with adding widgets yet doesn't cost you anything - you can always break the layout later.

Similar Threads

  1. Designer crashes when selecting some widgets
    By gwendal in forum Qt Tools
    Replies: 4
    Last Post: 21st July 2006, 13:18
  2. Adding slots in Designer
    By jamos in forum Qt Tools
    Replies: 5
    Last Post: 18th May 2006, 23:28
  3. Arthur Plugins demos and designer
    By antonio.r.tome in forum Installation and Deployment
    Replies: 4
    Last Post: 21st March 2006, 14:01
  4. Replies: 2
    Last Post: 14th February 2006, 15:28
  5. How to create custom slot in Qt Designer 4.1?
    By jamadagni in forum Qt Tools
    Replies: 31
    Last Post: 18th January 2006, 20:46

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.