hello experts,
Could you just tell me how to view the data stored in a QMap or QList.
Regards,
Sankar.
hello experts,
Could you just tell me how to view the data stored in a QMap or QList.
Regards,
Sankar.
What do you mean with view?
Do you want to print it with qDebug?
Do you want to view the data in a list widget of some kind?
do you mean something else?
What is stored in your map or list?
Is it a list of QString elements?
Is it a list of integers?
Is it a list of complex objects?
Is it ...?
hi sankar,
you can use myList.at(index) , list[index] to view individual item.how to view the data stored in a QMap or QList.
for readonly access, at() is faster
hope it helps
Bala
Thanks tbscope & Bala.
List of QString elements is stored in my QMap.
I would like to see the data in watch window of VisualStudio2008.
Is it possible to do?
Bala, I dont want to read it one by one and verify the data. But I would like to see the all the data in the map.
Regards,
Sankar.
tbscope already suggested using QDebug. There is convenient function called qDebug(), you can print almost every Qt datatype with it:
All of the above will print the containers in nice looking format.Qt Code:
QList<QString> s; qDebug() << s; QMap<QString,int> m; qDebug() << m;To copy to clipboard, switch view to plain text mode
hi sankar,
yes you can see all the data.
just give qDebug()<<myList;
you will see the all the members in the debug window.
Bala
Thanks for immediate responses...
Regards,
Sankar.
Bookmarks