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.

Qt Code:
  1. class A
  2. {
  3. classB *b;
  4. void f()
  5. QList<QString>* list = b->function();
  6. qDebug() << list.at(0); // getting error
  7. }
  8.  
  9. class B
  10. {
  11. QList<QString> Blist;
  12. void list()
  13. {
  14. int i=0;
  15. .....
  16. Blist.insert(i,"value");
  17. qDebug() << Blist.at(i);
  18. i++;
  19. }
  20. QList<QString>* function()
  21. {
  22. qDebug() << Blist.at(0) ; // printing the value at index 0
  23. return &Blist;
  24. }
  25. }
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