[Qt-interest] Grasping QGraphicsLayoutItem's size properties

Ingomar Wesp ingomar at wesp.name
Wed Oct 6 15:26:34 CEST 2010


Hey!

In order to write a custom QGraphicsLayout, I'm trying to get a better grasp 
of QGraphicsLayoutItem and it's size-related properties. After reading the 
documentation, I came to the following conclusions. Please correct me if I'm 
wrong:

set[minimum|preferred|maximum]Size(...)

overrides the sizeHint(...) of the QGraphicsLayoutItem so that the repective 
getters as well as effectiveSizeHint(...) will return the value specified here 
and not the one returned by sizeHint(...).

get[minimum|preferred|maximum]Size()

returns the appropriate, unconstrained sizeHint(...) of the 
QGraphicsLayoutItem if it hasn't been explicitly overridden by someone using 
the respective setters.

effectiveSizeHint(...)

returns (and caches) the appropriate sizeHint(...) if it hasn't been explictly 
overridden. If it has been overridden, returns the user defined values.

I'm not quite sure about the following:

- If I pass a constraint to effectiveSizeHint(...) and the queried sizeHint
  has been explicitely set, does effectiveSizeHint(...) always return the
  overridden value or does it call through to sizeHint(...) in this case?

- Does the sizePolicy affect any of this behavior or is it just an additional 
  hint for the QGraphicsLayout that manages the QGraphicsLayoutItems?

Thanks and best wishes,
Ingo



More information about the Qt-interest-old mailing list