Update LabelItem to allow transparency in the text#2300
Update LabelItem to allow transparency in the text#2300j9ac9k merged 2 commits intopyqtgraph:masterfrom
Conversation
Use the QColor.HexArgb NameFormat when retrieving the name of the color in setText to allow text with transparency
|
Hi @ElpadoCan Thanks for the PR! Are there I'm wondering if there are backward compatibility issues here I need to be concerned about; as |
|
Thanks! I didn't test on PyQt6, I have PyQt5. I subclassed |
The full enum namespace is mandatory on PyQt6 bindings but works on all the other bindings we support. The shortened namespace works on PySide2/6 and PyQt5. We don't put this in the documentation, but just an FYI checking against PyQt6 will catch these issues. Regarding the I'm toying with the example here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style Can you provide a code-snippet showing say, transparent Red text? |
|
Forgot to mention that I am not doing any additional string manipulation, I only added |
|
So I did some additional testing and I am confused. Every online HTML editor I tried requires the #RRGGBBAA format for color with transparency. However, I tried with Interestingly, my code editor also gives a preview of the color and interprets the hex string with the #AARRGGBB format, see this screenshot (the 80 in the hex string is for 50% transparency): In any case, since the #AARRGGBB format is the only alternative provided by Qt, my guess is that it is fully compatible with their HTML rendering. Here is a screenshot and the code-snippet with two QLabels, the label1 has the #RRGGBBAA but is then displayed as a blue color. |
|
Hi @ElpadoCan Sorry I didn't follow up a while ago, glad you share in my confusion, but it looks like Qt adheres to its own ARGB ordering (instead of RGBA) so that bit of code is fine. I do need the enum to change to it's full namespace one like I put in the in-line comment. Thanks! |
|
Hi @j9ac9k, I changed the enum to the full namespace. Let me know if we need any other change, thanks! |
|
Ha, this PR triggered a rather critical error (that has nothing to do w/ your code diff). |
|
Closing/Re-Opening to hopefully trigger a new CI run. |
|
Ok, passing now; LGTM, thanks for the PR merging! |



Use the QColor.HexArgb NameFormat when retrieving the name of the color in setText to allow text with transparency