[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Private classes and Q_Objects
From: "Nathan Bradshaw" <nathanlbradshaw () gmail ! com>
Date: 2008-05-02 21:14:56
Message-ID: 92af7fc70805021414p72ee2b69r61b7f34dcc28ff22 () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
cool, thanks very much for the answer Thiago.
So the private class is just cleaned up by deleting d_ptr in the public
class' destructor as per usual practice?
cheers
Nathan
On Fri, May 2, 2008 at 4:41 PM, Thiago Macieira <thiago@kde.org> wrote:
> Nathan Bradshaw wrote:
> >Hi all, I have a situation where I have a library with a private class /
> >s_ptr arrangement. I need to create an instance of a Q_OBJECT derived
> > class in the private class. What is the best method of parenting the
> > Q_OBJECT in the private class?
> >
> >Should I derive the private class from Q_OBJECT and make it the parent?
> >Should I use Q_DECLARE_PUBLIC / Q_Q() to get the private class' parent
> >(itself a Q_OBJECT derived class) and use that as the parent?
>
> The private class(es) should derive from QObject, have the Q_OBJECT macro,
> but they should have no parent.
>
> You'll control the lifetime of that class directly.
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> PGP/GPG: 0x6EF45358; fingerprint:
> E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
>
>
> >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to
> unsubscribe <<
>
>
[Attachment #5 (text/html)]
cool, thanks very much for the answer Thiago. <br><br>So the private class is just \
cleaned up by deleting d_ptr in the public class' destructor as per usual \
practice?<br><br>cheers<br>Nathan<br><br><br><div class="gmail_quote"> On Fri, May 2, \
2008 at 4:41 PM, Thiago Macieira <<a \
href="mailto:thiago@kde.org">thiago@kde.org</a>> wrote:<br><blockquote \
class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt \
0pt 0.8ex; padding-left: 1ex;"> <div><div></div><div class="Wj3C7c">Nathan Bradshaw \
wrote:<br> >Hi all, I have a situation where I have a library with a private class \
/<br> >s_ptr arrangement. I need to create an instance of a Q_OBJECT derived<br>
> class in the private class. What is the best method of parenting the<br>
> Q_OBJECT in the private class?<br>
><br>
>Should I derive the private class from Q_OBJECT and make it the parent?<br>
>Should I use Q_DECLARE_PUBLIC / Q_Q() to get the private class' parent<br>
>(itself a Q_OBJECT derived class) and use that as the parent?<br>
<br>
</div></div>The private class(es) should derive from QObject, have the Q_OBJECT \
macro,<br> but they should have no parent.<br>
<br>
You'll control the lifetime of that class directly.<br>
<font color="#888888"><br>
--<br>
Thiago Macieira - thiago (AT) <a href="http://macieira.info" \
target="_blank">macieira.info</a> - thiago (AT) <a href="http://kde.org" \
target="_blank">kde.org</a><br> PGP/GPG: 0x6EF45358; fingerprint:<br>
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358<br>
</font><br><br>
>> Visit <a href="http://mail.kde.org/mailman/listinfo/kde-devel#unsub" \
target="_blank">http://mail.kde.org/mailman/listinfo/kde-devel#unsub</a> to \
unsubscribe <<<br> <br></blockquote></div><br>
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic