[Development] New class for QtWidgets: ColumnResizer
agateau at kde.org
Tue Jun 17 15:21:17 CEST 2014
Saether Jan-Arve wrote:
> I would really like to welcome the feature you present here, but I can see
> that your idea has some caveats (some are sensible restrictions though),
> but the API doesn't give any indication of that.
> The main caveats are:
> 1. The implementation is limited to the first column of a layout, since it
> doesn't take the columns before the chosen column into account. Supporting
> other columns would require a bigger effort with the current approach.
It does support multiple columns: you can pass the column number to
> It assumes that the layouts are all aligned on their left edge, so for
> instance if one layout has a QGroupBox as a parent, and another one has a
> QStackedWidget as a parent (they can potentially have different
> contentsMargins), the items might end up not being properly aligned
True. But I would not trust code to adjust margins behind the developer back
so that things line up. ColumnResizer offers you a way to align things, but
you have to understand what it does.
> 3. It seems to change the size hint of QFormLayout, but not for
> QGridLayout. This is inconsistent.
It changes the size hint of items within QFormLayout, which was the only way
I found to make it work because QFormLayout does not have the equivalent of
QGridLayout::setColumnMinimumWidth(). Maybe such an equivalent could be
> With the above caveats in mind, I am therefore wondering if it isn't a
> better API to either strictly limit it to QGroupBox+QFormLayout
> hierarchies or create a separate QWidget subclass that ensures this.
> With such tighter requirement on the input I think the API would reflect
> much better the functionality it actually offers, and expose less
> surprises to the user.
I am not sure what such an API would look like, can you share more details?
More information about the Development