PDA

View Full Version : Problem with QMap



comlink21
10th December 2007, 05:22
please teach me what wrong with the following piece of code,



QMap<QString, QString> xMap;

for( int i = 0; i <100; i++)
{
QString cKey;
cKey = cKey.setNum(i);
xMap[cKey] = cKey;
}

The problem point to 'xMap[cKey] = cKey' line and say

error: no matching function for call to ‘QString::insert(QString&, QString&)

thank for reply...
comlink21..

DeepDiver
10th December 2007, 07:33
Hi,

I just compiled your code. I have no compiler errors on Linux & Qt 4.3.2.
Which platform? Which compiler? Which Qt-version? - These information is always necessary! ;-)

Good Luck,

Tom

PS: You can skip the assignment cKey = cKey.setNum(i). cKey.setNum(i) is enough.
Read the api docs carefully.