thanks for the answers!
Hashes have no order. You can create a list of pairs and sort it.
you mean like this?
class ColorCount {
public:
QRgb rgb;
int count;
operator <();
};
QList<ColorCount> colors;
...
qSort(colors);
class ColorCount {
public:
QRgb rgb;
int count;
operator <();
};
QList<ColorCount> colors;
...
qSort(colors);
To copy to clipboard, switch view to plain text mode
i thought about that too allready, but adding values to the list looks quite difficult and expensive to me, with QHash i could do:
QHash<QRgb, int> colors;
colors[QRgb(...)]++;
QHash<QRgb, int> colors;
colors[QRgb(...)]++;
To copy to clipboard, switch view to plain text mode
and with the list i have to search everytime through the whole list to find the right entry.
..although i could create a temporary QHash that just stores the position of the color in the QList... i guess the would speed it up again!
thx
niko
Bookmarks