Reputation: 26333
I have a class member of type QStringList
. I had a guess that when this class is instantiated, nex
instance get such a QStringLsit
with no elements in it.
I have a function that should fill in this QStringList
on user interaction. However, I see with debugger that class member does not exist at function call. What could it be all about? Is there a way to initialize the QListString
that I may be missing here?
Upvotes: 0
Views: 8995
Reputation: 45725
QStringList
should get initialized on the creation of your object automatically (unless it is a pointer). I see two possible explanations for the debugger's behaviour:
this
pointer is invalid when the function gets entered. This may be the case if you call the function on an uninitialised pointer to your class.QStringList
member correctly.QStringList*
(a pointer), it doesn't get automatically initialised on object creation. Then you'd need to do list = new QStringList();
in the constructor. But I doubt that you need a pointer to a string list here.Upvotes: 1