How to init: QList <type> * list;
Solved
General and Desktop
-
Hi, I have a Qlist:
QList <QHBoxLayout*> *listOfFieldLayouts;
that I want to initialize in the constructor. I tried doing this:
listOfFieldLayouts = new QList <QHBoxLayout*>();
but it says that they don't match, because of a pointer like this:
(operand types are 'QList<QHBoxLayout*>' and 'QList<QHBoxLayout*>*')
How do I make them match?
Hanna
-
@Hanna-Larsson
this code looks actually correct.
Can you post the exact error message and your code.
Which compiler are you using? -
@raven-worx I found the error, in my header it looked like this:
QList <QHBoxLayout*> listOfFieldLayouts;
which was wrong. Changed it to:
QList <QHBoxLayout*> *listOfFieldLayouts;
Thanks for your time!
-
@Hanna-Larsson said:
which was wrong. Changed it to:
which wasn't the case in the time i replied right?
-
@raven-worx When you replied I hadn't changed the header-file.