Qt 6.11 is out! See what's new in the release
blog
Getting data from a lot of QMaps into one QMap.
General and Desktop
6
Posts
3
Posters
7.6k
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, -
Ooops, sorry:P I forgot about it.
There is no message. There is "Program has unexpectly finished" if i put this line which is in "else":
@
else
{
total_of_first.insert(j.key(), j.value());
}
@ -
Actually, there shouldn't be way that map could be empty. But I'll check it out;)