Thanks everyone! This would have taken me ages to figure out. #4 it is.
From: Thiago Macieira
To: interest@qt-project.org
Sent: Thursday, February 23, 2012 10:49 AM
Subject: Re: [Interest] Proper use of SharedPointer/WeakPointer
On quinta-feira, 23 de
On quinta-feira, 23 de fevereiro de 2012 06.40.29, Jason H wrote:
> Hrm, my objects do have parents, and when the parent goes, the children need
> to go too. How is that resolved?
It isn't.
You must resolve this on your own. Suggestions:
1) don't set a parent
2) don't put them in a QSharedPointe
Hrm, my objects *do* have parents, and when the parent goes, the children need
to go too. How is that resolved?
From: André Somers
To: interest@qt-project.org
Sent: Thursday, February 23, 2012 9:37 AM
Subject: Re: [Interest] Proper use of SharedPointer
Op 23-2-2012 15:29, Thiago Macieira schreef:
> On quinta-feira, 23 de fevereiro de 2012 06.26.19, Jason H wrote:
>> So in a return-everything query function, it would look like:
>>
>> QList > ObjectDatabase::returnAll()
>> {
>> QList > results;
>> foreach (const obj, m_pObjects)
>>
On quinta-feira, 23 de fevereiro de 2012 06.26.19, Jason H wrote:
> So in a return-everything query function, it would look like:
>
> QList > ObjectDatabase::returnAll()
> {
> QList > results;
> foreach (const obj, m_pObjects)
> {
>
> results << QSharedPointer(obj);
> }
>
On Thursday 23 February 2012 07:40 PM, Jason H wrote:
I have an object database (objects inherit QObject) which is
queryable. The result of the query is a list of zero or more objects.
I don't want to give pointers themselves, as people could call delete
on them and destroy the database.
In t
I have an object database (objects inherit QObject) which is queryable. The
result of the query is a list of zero or more objects. I don't want to give
pointers themselves, as people could call delete on them and destroy the
database.
In this example:
QList results = objDb.query();
I want res