[Qt-interest] Qt memory management.

Ramesh ramesh.bs at robosoftin.com
Wed Aug 18 12:29:57 CEST 2010


Hi arnold,
Thanks for the reply...

With copy constructor I can copy one widget to another widget?..

And what about the reference count means?. I saw the QString class
destructor, there before deleting the object they check for reference count.
But QString is not a QObject right.

So it means, assignment of one Qstring to another does copy or not?



-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Arnold Krille
Sent: Wednesday, August 18, 2010 3:40 PM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] Qt memory management.

Hi,

On Wednesday 18 August 2010 11:15:19 Ramesh wrote:
> Qt widgets uses shared memory so  we can't copy a widget to another
> widget right?

No, QWidgets (and all QObjects) are organized in a tree. And copying within
a tree or from one tree to another needs copy-constructors and -operators
with two arguments (original and new parent).

> But in this case
> p2 = p1;
> both are Qpixmap object, and Qpixmap is not inherited from Qobject so
> assigning a pixamp to another leads to copy operation right?.

Yes.

Have fun,

Arnold


-----------------------------------------------
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an intended recipient, please notify the sender and delete all copies. Emails to and from our network may be logged and monitored. This email and its attachments are scanned for virus by our scanners and are believed to be safe. However, no warranty is given that this email is free of malicious content or virus.



More information about the Qt-interest-old mailing list