I have a problem when returning QList from a fucntion. I have two classes in which one class returns a QList from a fucntion and the other class catches this list. But I get null List returned though list in the other class has values. Below is my classes overview.
class A
{
classB *b;
void f()
QList<QString>* list = b->function();
qDebug() << list.at(0); // getting error
}
class B
{
QList<QString> Blist;
void list()
{
int i=0;
.....
Blist.insert(i,"value");
qDebug() << Blist.at(i);
i++;
}
QList<QString>* function()
{
qDebug() << Blist.at(0) ; // printing the value at index 0
return &Blist;
}
}
class A
{
classB *b;
void f()
QList<QString>* list = b->function();
qDebug() << list.at(0); // getting error
}
class B
{
QList<QString> Blist;
void list()
{
int i=0;
.....
Blist.insert(i,"value");
qDebug() << Blist.at(i);
i++;
}
QList<QString>* function()
{
qDebug() << Blist.at(0) ; // printing the value at index 0
return &Blist;
}
}
To copy to clipboard, switch view to plain text mode
Can any one please tell me why I am getting null list returned.
Thank You,
Baluk
Bookmarks