Qt How to change gridlayout column size
Asked Answered
P

1

6

Suppose I have a gridlayout of three columns. I want each column to have custom width. Seems to me that the width of the columns are fixed automatically.

How can I do this in the qt designer?

Pinter answered 19/10, 2015 at 4:18 Comment(2)
To set size column You can use setColumnMinimumWidth(), but You also must manipulate setSizePolicy for each element in column as QLabel, QGroupBox etc, because policy determines how behavior must be particular object in column. Look Here doc.qt.io/qt-4.8/qsizepolicy.html also probably find some here #4553804Subatomic
So without the manual tweaking, with the help of GUI(in qtDesigner) the individual column widths cannot be changed? :/Pinter
D
3

You can do it in the QT Designer (GUI)

  1. First, use the Grid Layout widget (say, you want 3 column)
  2. Second, in the Property Editor, choose the layoutColumnStretch and enter value (such as 200,100,100)

Result: 1st column 200px, 2nd column 100px, 3rd column 100px,

Delphadelphi answered 3/6, 2021 at 4:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.