Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QGridLayout with cells of constant size
fthe last edited by
Say I have a QGridLayout with a custom QWidget in each cell. The QGridLayout can be modified by buttons, adding or removing cells in a fixed pattern (1x1, 2x1, 2x1 and 1x2 underneath, 2x2 etc.). The custom QWidget has a QLabel in it, showing a QString that can change during runtime.
Now, what I would like to have is a semi-fixed size QGridLayout. "Semi-fixed" because I'd like it to adapt to the window size, but the relative sizes of the cells should remain be fixed, taking up an equal amount of space each.
I more or less succeeded in doing it. I have a Layout manager in my Main Window communicating the window size to the QGridLayout, and I can modify my QGridLayout. The problem is that the variable size String changes the size of the custom QWidget, which communicates the size change to the QGridLayout (I assume...?), which gives it more space. Something... IT SHOULD JUST NOT DO. I want the size of the cells to be constant.
I've been fighting with this thing for a while now, so ... dear forum, can you help?
Thanks alot in advance!