[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&#39; 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 &lt;<a \
href="mailto:thiago@kde.org">thiago@kde.org</a>&gt; 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> &gt;Hi all, I have a situation where I have a library with a private class \
/<br> &gt;s_ptr arrangement. I need to create an instance of a Q_OBJECT derived<br>
&gt; class in the private class. What is the best method of parenting the<br>
&gt; Q_OBJECT in the private class?<br>
&gt;<br>
&gt;Should I derive the private class from Q_OBJECT and make it the parent?<br>
&gt;Should I use Q_DECLARE_PUBLIC / Q_Q() to get the private class&#39; parent<br>
&gt;(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&#39;ll control the lifetime of that class directly.<br>
<font color="#888888"><br>
--<br>
&nbsp; Thiago Macieira &nbsp;- &nbsp;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> &nbsp; &nbsp; PGP/GPG: 0x6EF45358; fingerprint:<br>
&nbsp; &nbsp; E067 918B B660 DBD1 105C &nbsp;966C 33F5 F005 6EF4 5358<br>
</font><br><br>
&gt;&gt; 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 &lt;&lt;<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