Results 1 to 3 of 3

Thread: Can Layouts Stretch to Fit?

  1. #1
    Join Date
    Dec 2009
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Can Layouts Stretch to Fit?

    Hey all,
    I'm attempting to rewrite a kiosk management program that I originally wrote in GTK. The main problem I'm having is that I cannot make my layouts stretch to fit all available space, so when my application switches to fullscreen mode, nothing is centered. In GTK, the default behavior is stretch to fit, but I cannot find a way to do this in Qt4. What am I missing?

    Thanks,
    Kyle

  2. #2
    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: Can Layouts Stretch to Fit?

    You have to set appropriate size policies for your widgets. It is also possible that you are using layouts incorrectly. Can you give us some more info? An ui file would be nice.
    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.


  3. #3
    Join Date
    Oct 2009
    Posts
    151
    Thanks
    6
    Thanked 13 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Can Layouts Stretch to Fit?

    Layouts caused me a lot of confusion when I first came across them using the designer.

    If you use this to build your UIs you will see a layouts section where you can drag and drop a layout onto your UI.

    Do not use this, it will make the UI form the container of your layout just like any other item dragged and dropped on to it, which is probably not what you want and is unlikely to behave as you expect. By default there is nothing to resize the container, so the layout will never get resized.

    Instead right click on the item whose layout is to be managed, choose layout from the menu and attach the required layout this way. You can control-click to choose multiple items.

    If you are using a container, eg a Tab Widget, you will need to place its contents into layouts first (vertical and horizontal seem to work best) and then allocate the container itself to a another layout.

    I hope this makes sense. Good luck.

Similar Threads

  1. Replies: 0
    Last Post: 17th April 2009, 08:58
  2. Layouts and allowing view to stretch with main window
    By steg90 in forum Qt Programming
    Replies: 1
    Last Post: 15th May 2007, 10:30
  3. Problems putting layouts inside groupbox
    By conexion2000 in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2006, 10:01
  4. Referring to unnamed layouts from designer
    By Ben.Hines in forum Qt Tools
    Replies: 1
    Last Post: 13th April 2006, 21:54
  5. 2 Questions about layouts
    By SkripT in forum Qt Programming
    Replies: 1
    Last Post: 26th February 2006, 13:54

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.