
Originally Posted by
Lykurg
After you have counted your words in a (temporary)
QHash, transform it to a list of
QPair's and sort it
Lykurg, tks.
I try:
typedef QHash<QString, int> WordCount;
....
QList<QPair<WordCount,int> > items;
QPair<WordCount,int> pair;
pair.first = myHash;
pair.second = totalKeys;
items.append(pair);
qSort(items.begin(), items.end(), sorting);
typedef QHash<QString, int> WordCount;
....
QList<QPair<WordCount,int> > items;
QPair<WordCount,int> pair;
pair.first = myHash;
pair.second = totalKeys;
items.append(pair);
qSort(items.begin(), items.end(), sorting);
To copy to clipboard, switch view to plain text mode
bool sorting(const QPair<WordCount,int>& e1, const QPair<WordCount,int>& e2) {
//if (e1.first.value() < e2.first.value()) return true; // *** Not Working ***
return true;
}
bool sorting(const QPair<WordCount,int>& e1, const QPair<WordCount,int>& e2) {
//if (e1.first.value() < e2.first.value()) return true; // *** Not Working ***
return true;
}
To copy to clipboard, switch view to plain text mode
Bookmarks