I have a class that contains a QMap object:
QMap<QString, Connection*> users;
Now, in the following function Foo(), the if clause always returns false but when I iterate through the map, the compared QString, i.e., str1 is present in the keys.
void Foo(QString& str1, QString& str2)
{
if(users.contains(str1))
users[str1]->doStuff(str2);
else
{
for(QMap<QString, Connection>::iterator iter = users.begin();
iter!= users.end();iter++)
qDebug()<<iter.key();
}
}
Am I doing something wrong? Why doesn't contains() return true ?