Is possible to set the column span of a QLineEdit
box after it has been added to the layout? I have two QLineEdit
boxes in a QGridLayout
that are right next to each other horizontally. During the execution of some of my code, one of these boxes gets hidden. I would like to increase the column span where the hidden one was to avoid a weird gap at the end, and reduce it when needed.
I couldn't really find anything in the Qt documentation for this type of change beyond making the adjustment prior to adding the widget to the layout.
There no method for resetting the row- or column-span after a widget has been added. However,
addWidget
can be called again on the same widget to achieve the same affect, because re-adding a widget to the same layout always implicitly removes it first. So something like this should work:Here is a simple demo script: