i have problems when i try to use the iterator with a list an a custom class T. it seems that is out of scope.
this is an example that explains better my point.
include "t.h"
include <QList>
class p
{
public:
void my_function();
private:
QList<T> list;
}
include "t.h"
include <QList>
class p
{
public:
void my_function();
private:
QList<T> list;
}
To copy to clipboard, switch view to plain text mode
in the implementation:
T::my_funcion()
{
QList<T>::iterator it;//here it seems to be the problem,, because i think this class P, isnt the main class
for(it=list.begin();it!=list.end();it++)
{
//at this time i an only avaible to do this
list.at(i).show();//where show() is an public function of the object T
}
//obviouslly the compiler show the message warning that is not right to do this
//thenn compiler doesnt do nothinhg and do not compile the program
}
T::my_funcion()
{
QList<T>::iterator it;//here it seems to be the problem,, because i think this class P, isnt the main class
for(it=list.begin();it!=list.end();it++)
{
//at this time i an only avaible to do this
list.at(i).show();//where show() is an public function of the object T
}
//obviouslly the compiler show the message warning that is not right to do this
//thenn compiler doesnt do nothinhg and do not compile the program
}
To copy to clipboard, switch view to plain text mode
the main intention is to declare a object that use the QList class an declare function to work whit this class in the main class
some help pleasa!!
Bookmarks