[Kde-bindings] smoke (non-q)object ownership proposal/question

Arno Rehn arno at arnorehn.de
Wed Jul 14 16:17:52 UTC 2010


On Monday 12 July 2010 08:51:29 Petr Vanek wrote:
> here is my initial draft of a question/proposal for smoke:
> 
> Meta Information in Smoke
>
> [snip]
> 
> Is there any idea or plan to provide this kind of information in a
> generic way in smoke (somehow in a per-library way) so that it could
> be used by any client of the binding?
> 
> If not, from my not very deep knowledge of smoke, I was imagining that
> the best way would be to provide a mechanism in smoke itself to track
> ownership of objects and then to provide a way in smoke itself to
> manage the ownership status of the object based on some simple rules
> (i.e. QLayout::addItem() called on the object - object externally
> owned, QLayout::removeItem() called on the object, object not
> externally owned).
Yes, you could add such meta information to SMOKE - I don't know if this is 
the correct way to do it, though. It would require quite some amounts of 
manual work, just to flag all those methods as 'ownership-changing'.

In QtRuby and Qyoto we use a global event filter to track QEvent::ChildAdded 
and QEvent::ChildRemoved events and handle ownership according to this. This 
only works for QObject derived-classes, of course, so it is a bit limited. For 
QGraphicsStuff you can track the virtual itemChanged() method and update 
ownership information accordingly.

There are other cases where we simply can't track ownership that easily and 
which then needs some manual help. But I'm not sure if this should all be put 
into SMOKE, given that we have rather generic ways of tracking most of the 
ownership information.

-- 
Arno Rehn
arno at arnorehn.de



More information about the Kde-bindings mailing list