
Originally Posted by
dobedidoo
Well, I'm quite a beginner in C++/Qt,
...then please use the Newbie section. We also read and answer thread there and know that the users aren't so good with C++/Qt. Then we answer in more detail.
so I'm not sure I fully understand what that means - to "
allocate it on the stack, not on the heap".
I wrote that because you had an asterisk in your definition. So for you everything is fine if you use it like:
// header file
class MyClass
{
//...
private:
QList<QPointer<someQClass> > myQPointerList;
}
// and in the implementation you can use it everywhere
void MyClass::someFunction()
{
myQPointerList.append(new someQClass);
// etc.
}
// header file
class MyClass
{
//...
private:
QList<QPointer<someQClass> > myQPointerList;
}
// and in the implementation you can use it everywhere
void MyClass::someFunction()
{
myQPointerList.append(new someQClass);
// etc.
}
To copy to clipboard, switch view to plain text mode
Bookmarks