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?
I have a class member of type QStringList . I had a guess that
Share
QStringListshould get initialized on the creation of your object automatically (unless it is a pointer). I see two possible explanations for the debugger’s behaviour:thispointer is invalid when the function gets entered. This may be the case if you call the function on an uninitialised pointer to your class.QStringListmember correctly.QStringList*(a pointer), it doesn’t get automatically initialised on object creation. Then you’d need to dolist = new QStringList();in the constructor. But I doubt that you need a pointer to a string list here.