QObjects on interfaces
apaku at gmx.de
Fri Jul 25 13:27:51 UTC 2008
On 25.07.08 14:14:54, Michal 'vorner' Vaner wrote:
> On Fri, Jul 25, 2008 at 01:55:26PM +0200, Andreas Pakulat wrote:
> > Another problem with QObject: You can't copy them or pass them via
> > const-ref. The only way to pass around a QObject is by pointer and its
> > not really nice to change a pure "datastructure" class that is copyable
> > and assignable to something that needs more thinking. Specifically about
> > object-ownership.
> Correction: you can pass anything as ref or const-ref. Ref is internally
> just a pointer, it just pretends not to be. You just have to make sure
> it does never copy out of the ref (assignment to something static) and
> it does not die when some of the references still exist.
Of course, must be the heat around here :)
> And, you can always write your own operator= and create yourself a new
> QObject as the base, if you need it.
Ok, technically it is possible. But in practice it usually doesn't make
too much sense.
You will be advanced socially, without any special effort on your part.
More information about the KDevelop-devel