[Interest] QIcon on/off doesn't work on QAction
Sensei
senseiwa at gmail.com
Fri Jul 5 10:21:37 CEST 2013
On 7/3/13 2:13pm, Christoph Feck wrote:
> On Wednesday 03 July 2013 11:36:26 Sensei wrote:
>> original version and the scaled down one, but it doesn't work: when
>> I click on the toolbar's action the icon doesn't get blue.
>
> Did you check in the QToolBar sources, that buttons there indeed use
> the "On" state to denote pressed icons? From looking at the image in
> the QIcon documentation, you should use a different mode.
>
I've proceeded in adding the two icons (gray and blue) in every
combination of Mode and State. Nothing. I might be missing something here.
However, if I don't add the original one, but create a new light gray
version, it *darkens* when clicked:
QIcon i;
gray.fill(QColor(64 + 16, 64 + 16, 64 + 16));
gray.setMask(orig.createMaskFromColor(Qt::transparent));
blue.fill(QColor(64 - 32, 160 - 32, 255 - 32));
blue.setMask(orig.createMaskFromColor(Qt::transparent));
i.addPixmap(blue, QIcon::Normal, QIcon::On);
i.addPixmap(gray, QIcon::Normal, QIcon::Off);
That's fine, but I'd like to understand better which states and modes
are used. I find it surprising that this might be a color issue.
More information about the Interest
mailing list