I want to add all the selected colors into a list without duplicate entry and later all the selected colors should popup in a widget.
How can I add QColor into list and later extract it
I want to add all the selected colors into a list without duplicate entry and later all the selected colors should popup in a widget.
How can I add QColor into list and later extract it
QColor
does not provide a hash function forQSet
orstd::unordered_set
by default. You can add that locally (or globally for your program) though by delegating that to the hash function for QRgb (which includes alpha value as well):Or you can also not put the
QColor
s into the set, but theQRgb
values (viaQColor::rgba()
), and later convert them back toQColor
via theQColor(QRgb)
constructor again.