-
-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: How to Change Icon Color #243
Comments
Hi @mgh2010 ! Not totally sure what would be triggering the color change in your use case but maybe a check to the toggle state styling example could be useful: https://qtawesome.readthedocs.io/en/latest/usage.html#examples ( Let us know if the info above helps! |
I'm not sure if my question is same as OP, but worth a try, I guess. I am aware, that I can get a QIcon with colored glyph when it is instantiated like this:
Then, I can use this to set pixmap of a QMessageBox, which works fine, too:
However, then the icon is the same color, from instantiation to end of its lifetime. My question is: Sure we can change color, if we instantiate a new QIcon with e.g. red color after 10 seconds (and delete the previus qicon from memory) -- but can we change color of the same QIcon after instantiation (without deleting it and instantiating a new open)? Say, I show the icon 10 seconds in darkgray, then 10 seconds in red (without instantiating a new QIcon)? ... I guess that is what OP meant by:
This could also help with animating the icon color, I guess ... In any case, I can see that IconicFont basically uses draw color from a dict; one can do
... I could (maybe) hope the pixmap applied to messagebox to be green; however, there is no equivalent to
... then this has no effect, - somewhat as expected, because by the time I've said So, yeah - is there a way to change the icon glyph color, without re-instantiating the qicon for that glyph? ( my problem is that I have an init method that already accepts 10003204958209384092834098 arguments, and I have a headache just looking at it, and I really do not want to add a new input argument "glyph_color" to this method, I'd rather just do the instantiation first, and change color later) |
i have Question: there is in some situation that we want to change the color for the icon. Is there an option to change the color or do we have to delete the icon and create it again with a new color?
The text was updated successfully, but these errors were encountered: