It seams there are problems with QGraphicsLayout::activate()
Calling it (manually) simply does not work - setGeometry() is not called, as
the docs say.
After some debugging it became clear that when activate() is called, first its
sets isActivated()
to true, and thats fine:
bool QGraphicsLayout::isActivated () const
Returns true if the layout is currently being activated; otherwise, returns
false.
If the layout is being activated, this means that it is currently in the
process of rearranging its items
(i.e., the activate() function has been called, and has not yet returned)
....the problem is - isActivated is never set back to false!
Simple qDebug() for isActivated() from anywhere in the client code proofs that
easily.
Looking into the code,
the last command in activate() is:
// ### bug, should be parentItem ?
parentLayoutItem()->updateGeometry(); // bubble up; will set activated to false
that's ok, but no implementation of updateGeometry() exist, that will set
activated back to false!
Looking deeply into the code,
the possible parents of the layout in question are:
QGraphicsLayoutItem - it only clears the sizehint cache
QGraphicsLayout - calls the above QGraphicsLayoutItem implementation and
updateGeometry() for all of its parent layouts.
If the parent is not a layout it calls invalidate() on itself... I don't
pretend to know all the code at 100%, and maybe this invalidate is
meant to do the trick.... But this scenario is highly unlikely - it means the
layout that calls activate() in the first place, has to have a parent layout
(be part of another layout), which also has a parent that is not a layout !?!
...Hope I got this right...
QGraphicsWidget - the most common scenario. It also calls the
QGraphicsLayoutItem implementation and updateGeometry()
for all of its parent layouts. If the parent is a widget, it posts
LayoutRequest to it, and that it resize itself.
Im by no means Qt expert, so I might be missing something, but this seams to be
the picture...
Anyways, the reason Im worried is because without activate() there is no way to
call any layout with cached values,
even the existing Qt ones that do implement caching...
One can allays use invalidate() instead, which sets activate to false, but also
clears any cached layout geometry.
Thank You
MihailNaydenov
_______________________________________________
Qt4-preview-feedback mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt4-preview-feedback