Results 1 to 2 of 2

Thread: Layouts do not align to parent Widget

  1. #1
    Join Date
    Mar 2014
    Posts
    1
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Question Layouts do not align to parent Widget

    Hello,

    I am developing under Windows 7 64bit, Qt5.5. minGW 4.9.2. When I created applications previously I never had problems regarding the alignment of layouts.

    I start an empty Widget application with a MainWindow. Then i place (in the QtCreator Designer) in its centralWidget a verticalLayout to order my further PushButtons, and LineEdits ect.
    MainWindow -> (child) centralWidget -> (child) verticalLayout
    .................................................. ....................+--> (child) pushButton_1
    .................................................. ....................+--> (child) pushButton_2
    .................................................. ....................+--> (child) pushButton_3
    .................................................. ....................+--> (child) lineEdit_1
    .................................................. ....................+--> (child) lineEdit_2

    The verticalLayout orders the lineEits and PushButtons properly. But the verticalLayout Object itself does not aling to its parent centralWidget. When I resize my running MainWindow, I would like the verticalLayout be aligned to its parent.

    I appreciate any hints, thnaks in advance.
    Sincerly

    LesPaul

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Layouts do not align to parent Widget

    Three ways to do it from Qt Designer
    1. Select the MainWindow, then right click on it and select Lay out->Lay out Horizontally. (or Vertically or Grid)
    or
    2. Select the MainWindow, Click the "Lay out Horizontallt Ctrl+H" on tool bar icon (similar to Vertical Layout).
    or
    3. Just select the MainWindow and hit Ctrl+H from the keyboard.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

Similar Threads

  1. How to resize parent widget when child widget is resized
    By ainne810329 in forum Qt Programming
    Replies: 4
    Last Post: 29th November 2011, 07:47
  2. Replies: 1
    Last Post: 11th March 2011, 19:34
  3. Replies: 8
    Last Post: 20th June 2010, 19:15
  4. Replies: 7
    Last Post: 14th January 2010, 08:47
  5. How can I change widget images and layouts?
    By sendyou in forum Qt Programming
    Replies: 1
    Last Post: 20th August 2008, 11:07

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.