c++ - QMutableStringListIterator's QStringList "not a type"? -
i have qmutablestringlistiterator
want use iterate through qstringlist
, keep getting error in .h
file says qstringlist
not type. why?
myclass.h
#ifndef myclass_h #define myclass_h #include <qdockwidget> #include <qlist> #include <qstringlist> #include <qmutablestringlistiterator> namespace ui { class myclass; } class myclass: public qdockwidget { q_object public: explicit myclass(qwidget* parent = 0); void somefunc(qstring message); ~myclass(); private: ui::messages* ui; qstringlist mylist; qmutablestringlistiterator iterator(mylist); // errors here. "mylist not type" }; #endif // myclass_h
myclass.cpp
#include "myclass.h" #include <qstring> #include <qdebug> #include <qcoreapplication> myclass::myclass(qwidget* parent) : qdockwidget(parent), ui(new ui::myclass), iterator(mylist) { ui->setupui(this); } myclass::~myclass() { delete ui; } void myclass::somefunc(qstring message) { mylist.append(message); qdebug() << mylist.length(); }
i fixed it. here's .h
file should like:
private: ui::messages* ui; qstringlist mylist; qmutablestringlistiterator iterator; // not give mylist here };
Comments
Post a Comment