PDA

View Full Version : Layouts do not align to parent Widget



lespaul
7th July 2015, 12:22
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

Santosh Reddy
7th July 2015, 13:41
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.