QObjects on interfaces

Michal 'vorner' Vaner vorner at ucw.cz
Fri Jul 25 12:14:54 UTC 2008


Hello

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.

And, you can always write your own operator= and create yourself a new
QObject as the base, if you need it.

-- 
There is one difference between linux and windows.
With windows, you pay for the software, but you get all the T-shirts for free.
With linux, you get all the software for free, but you buy the T-shirts.

Michal 'vorner' Vaner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20080725/7817cb63/attachment.sig>


More information about the KDevelop-devel mailing list