PDA

View Full Version : QMAP<QString, QStringList>



bismitapadhy
4th February 2010, 04:14
Ihave
QMap<QString, QStringList> m_mapTestcaseFileToIDs;

QList<QStringList> testcaseID = m_mapTestcaseFileToIDs.values(tclFile);

Its returning a list of stringlist.But this is actually should return only a QString.

Here we need to use one more extra loop,
Any solution to find the value easily.

aamer4yu
4th February 2010, 04:40
I guess you wanted QMap::value

bismitapadhy
4th February 2010, 04:43
Ues i want to use QMap::value
I tried for
const QMap<QStringList, QString> abc = m_mapTestcaseFileToIDs.value(tclFile);

But it is giving error that
D:\FATT\Gui\MainWindow.cpp(1510) : error C2440: 'initializing' : cannot convert from 'const class QStringList' to 'class QMap<class QStringList,class QString>'
No constructor could take the source type, or constructor overload resolution was ambiguous

aamer4yu
4th February 2010, 04:47
QMap<QString, QStringList> m_mapTestcaseFileToIDs;
This says you have created a map based on QString . If you enter a QString, it will give the corresponding QStringList.
You will have to do something like -
QStringList list = m_mapTestcaseFileToIDs.value(tclFile);