0

QT column occupied issue with add widgets

Hi I have a QGridLayout of rowspan 1 and columnspan 8. I have 5 widgets to be placed in a raw and hence rowspan is 1 , but kept columnspan as 8 as I need three column space left in after third widgets . Something like below: column 1 : label column 2 : checkbox column 3 : combo box column 4 : EMPTY column 5 : EMPTY column 6 : EMPTY column 7 : line edit column 8 : push button I am doing AddWidget (widget,startrow,startcol,rowspan,colspan) as below: AddWidget(widget,0,0,1,1); AddWidget(widget,0,1,1,1); AddWidget(widget,0,2,1,1); AddWidget(widget,0,6,1,1); AddWidget(widget,0,7,1,1); Why all widgets are adjacent to each other and there is no space left? Am I missing anything?

22nd Aug 2024, 3:40 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
6 Antworten
22nd Aug 2024, 4:27 PM
Bob_Li
Bob_Li - avatar
+ 1
I got rid off the grid layout and returned back to hboxlayout. Added spacer in between to have the space in between widget.
24th Aug 2024, 7:52 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
Thanks but is it necessary to use the extra widget spacer? If it is needed, why do we have start column if it does not have any sense?
22nd Aug 2024, 4:37 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
or perhaps you should assign a value for setColumnMinimumWidth for columns 4,5 and 6? Perhaps they're defaulted to 0 width.
22nd Aug 2024, 4:55 PM
Bob_Li
Bob_Li - avatar
0
Unfortunately , setColumnMinimumWidth also did not help
23rd Aug 2024, 6:13 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
is the gridlayout nested inside another container? Perhaps that is forcing the compression by constraining the expansion space? how about enabling expansion by adding a QScrollArea? https://forum.qt.io/topic/102622/add-space-to-qtgridlayout
23rd Aug 2024, 6:42 AM
Bob_Li
Bob_Li - avatar