[Development] New class for QtWidgets: ColumnResizer

Saether Jan-Arve Jan-Arve.Saether at digia.com
Sun Jun 15 01:17:24 CEST 2014


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.
2. 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 afterall.
3. It seems to change the size hint of QFormLayout, but not for QGridLayout. This is inconsistent.

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.

Jan Arve

Fra: development-bounces+jan-arve.saether=digia.com at qt-project.org [development-bounces+jan-arve.saether=digia.com at qt-project.org] på vegne av Aurélien Gâteau [agateau at kde.org]
Sendt: 12. juni 2014 14:40
Til: development at qt-project.org
Emne: [Development] New class for QtWidgets: ColumnResizer


Some time ago I created a class to help keeping columns of widgets to the
same width across layouts, so that if you have two QGroupBoxes on top of
each others with form layouts, then you can ensure the label columns of both
boxes are the same width.

I proposed it for inclusion in the KWidgetsAddons KDE framework, but it was
pointed out to me that this class could as well go to QtWidgets. You can
find the code in the KWidgetsAddons review request:

I'd like to ask if it has a chance to be accepted? Before I start creating a
branch of QtBase for it and submit it to Gerrit.


Development mailing list
Development at qt-project.org

More information about the Development mailing list