Getting data from a lot of QMaps into one QMap.
General and Desktop
6
Posts
3
Posters
6.7k
Views
1
Watching
-
Hello everyone,
recently I got an strange (for me) error by my project. Idea is: from a couple of QMaps I need to retrieve data and put into one QMap.
I wrote this piece of code: (getKeywords() returns a QMap<QString, unsigned>)
@
QMap<QString, unsigned> total_of_first;for(int i = 0; i < this->first->getLogsNumber(); i++) { for(QMap<QString, unsigned>::iterator j = this->first->getPool().at(i)->getKeywords().begin(); j != this->first->getPool().at(i)->getKeywords().end(); j++) { if(total_of_first.contains(j.key())) { total_of_first[ j.key() ] += j.value(); } else { total_of_first.insert(j.key(), j.value()); // I found out that problem is here, but actually I don't know why } } }@
Could anyone give me a tip how to resolve this problem? I'll be very glad for all hints.
Best regards,