[Qt-interest] Height for Width in QGraphicsLinearLayout / QGraphicsGridLayout

Ingomar Wesp ingomar at wesp.name
Wed Oct 20 23:22:40 CEST 2010


Hi!

I've been experimenting with two of the built-in QGraphicsLayouts 
(QGraphicsLinearLayout, QGraphicsGridLayout) lately and noticed that their 
children's sizeHint methods are never called with any constraints, even if the 
items have a size policy, that has heightForWidth set to true.

In the case of a horizontal QGraphicsLinearLayout, I would have expected it to 
ask my items for their vertically constrained preferredSize, but they were 
just asked for their unconstrained preferredSize instead.

The size policy I'm setting on the children looks like this (although I tried 
multiple variants just in case I haven't understood the impact of the 
horizontal/vertical policies and stretch factors correctly):

| QSizePolicy policy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
| policy.setHeightForWidth(true);
| policy.setHorizontalStretch(1);
| policy.setVerticalStretch(1);

Am I missing something or is height for width really not supported in the 
built-in layouts?

Best regards,
Ingo



More information about the Qt-interest-old mailing list