On 10/2/19 5:19 PM, Pierre-Yves Siret wrote:

While using layouts in the Qt Quick world, you use Layout attached properties to give hints to the layout system :

Sure it is a subset of the options you have with the corresponding layouts of the widgets world.

It is possible to set the explicit min/preferred/max hints, but of course the implicit hints can't be done this way. And as dynamic constraints ( heightForWidth/widthForHeight ) are always implicit, these layouts do not support them.

In case anyone is interested: I wrote a small demo ( https://github.com/uwerat/qskinny/tree/master/playground/grids ) that shows side by side, what the different grid layout implementations are doing, when being fed with same attributes. It is interesting how many obvious differences/bugs you find - even in QGridLayout, that has a history of > 15 years.

I decided not to write bug reports ( explanations are in the code ), as I don't expect anyone fixing them. The QGraphicsWidget stuff has become obsolete ( why is this not already deprecated ? ) and probably nobody wants to touch the widgets layouts - even if it is actually a bug fix.

Qt/Quick layouts are only a thin layer on top of the graphics view layout engine and could be reimplemented from scratch in 2-3 days - in case someone wants to do it.

I don't understand/visualize what you mean.

Classic layouting usually means stacking of box/grid layouts. Each box makes use of the information of the child boxes - actually child boxes are not different than basic controls.

So it is important, that each box offers the same min/pref/max hints to its parent box - and of course these values should be calculated automatically. F.e when having a horizontal linear layout, the preferred width of the layout can easily calculated by adding the preferred widths of the children.

The graphics view layout system is the most complete implementation. F.e have a look at: https://doc.qt.io/qt-5/qgraphicslayoutitem.html#sizeHint

This method does not only calculates the accumulated pref/min/max values it can also be fed with a constraint: when one of its width/height is >= 0 a heightForWidth/widthForHeight calculation is performed.

So whenever you have to do layout calculations you can rely on having these information from your children.

Uwe


_______________________________________________
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to