Results 1 to 5 of 5

Thread: More layout woes: Can a QLayout be made to respect its parent's dimensions?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2009
    Posts
    13
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default More layout woes: Can a QLayout be made to respect its parent's dimensions?

    Hello out there,
    I want to line up some widgets in a "row":
    - flush left: a combo and a label
    - flush right: 2 buttons
    and a spacer in between to fill out the remaining space.

    The goal: If the parent of the "line" shrinks or grows, the widgets on the left resp. right side should stay flush left (right) and the spacer in the middle should take care of the space in the middle. I thought that a horizontal layout would be what is needed but apparently I am wrong.
    If you look at image 1 you see the widgets lined up in a frame. Note that the combo and the buttons have their original/default width reduced.
    In image 2 I have a horizontal layout applied to them:
    - The whole "line" now extends way beyond the parent's width, and
    - the combo as well as the buttons returned to their default width.

    2 questions please:
    - What is the "Qt way" of achieving what I want: 2 widgets stay on the left, 2 on the right, their sizes do not change and the middle part takes care of the remaining space?
    - Since I evidently do not use Qt's layouts the way they are intended to be used: Where can I learn how to use them?

    Any help will be greatly appreciated.
    Best regards
    Helmut Giese
    Attached Images Attached Images

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.