Results 1 to 4 of 4

Thread: Layouts - very confused

  1. #1
    Join Date
    Jul 2009
    Posts
    2
    Qt products
    Qt3
    Platforms
    MacOS X Unix/X11 Windows

    Default Layouts - very confused

    Hello,

    I'm new to Qt and have been slowly experimenting with building a GUI including looking through many of the examples.

    I'm trying to put together a GUI using a main widget to add the elements to with the main widget set as the central widget in a QMainWindow.

    I did some experimenting yesterday and I need to know if what I saw was correct. It seems to me that you don't get correct placement of widgets that you add and that the positioning will continue to change as the form is built. When finally done you then have to go in and tweak things to put them in the right place.

    I came to this conclusion after taking the "widgets" example and commenting out everything after the inclusion of the analog and digital clock widgets (other examples) and saw that they were not in the same place as they were in the final layout.

    Can anyone give me some guidelines on how to assemble a GUI with Qt so I know what to expect?

    Thanks.

    Les

  2. #2
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Layouts - very confused

    Quote Originally Posted by lhartzman View Post
    It seems to me that you don't get correct placement of widgets that you add and that the positioning will continue to change as the form is built.
    Er... It's not a bug, it's a feature. More precisely it is the very purpose of layouts : adapting size/position according to the space available and the number of widgets (each with its own size constraints) to squeeze in it.

    If you want to build fixed size layouts by hand and adjusting widget size/position by the pixel it is of course possible but it doesn't make much sense and takes a lot more time...
    Current Qt projects : QCodeEdit, RotiDeCode

  3. #3
    Join Date
    Jul 2009
    Posts
    2
    Qt products
    Qt3
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Layouts - very confused

    Quote Originally Posted by fullmetalcoder View Post
    Er... It's not a bug, it's a feature. More precisely it is the very purpose of layouts : adapting size/position according to the space available and the number of widgets (each with its own size constraints) to squeeze in it.

    If you want to build fixed size layouts by hand and adjusting widget size/position by the pixel it is of course possible but it doesn't make much sense and takes a lot more time...
    I'm not saying that it is a bug. I'm trying to understand how to build a GUI if I don't know what to expect as I populate the form.

    If I want to put a few widgets into a layout and I want them at the top of the form, what do I have to do to get them moved up to the top, just below the menu bar. If I want to move items to the bottom, what do I have to do?

    I need to understand the process so I know how to make it work for me.

  4. #4
    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: Layouts - very confused

    Use the so called "spacers". They are those little blue springs in Designer.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 0
    Last Post: 17th April 2009, 08:58
  2. GraphicsItems and layouts
    By godmodder in forum Qt Programming
    Replies: 1
    Last Post: 17th November 2008, 08:43
  3. How can I change widget images and layouts?
    By sendyou in forum Qt Programming
    Replies: 1
    Last Post: 20th August 2008, 11:07
  4. Problems putting layouts inside groupbox
    By conexion2000 in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2006, 10:01
  5. 2 Questions about layouts
    By SkripT in forum Qt Programming
    Replies: 1
    Last Post: 26th February 2006, 13:54

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.