Add ColorPicker dialog with checkerboard alpha #3813
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So, I was working on generalizing my non-modal QColorDialog changes from the Blender dialog and moving them to the rest of the places where you can select a color in OpenShot, and as I was testing in the Title Editor I realized how unhappy I was with the current functionality, specifically the support for transparency.
A lot of our title templates use transparent backgrounds, which often are colored white (simply because that's the default and nobody changed it). When you go to edit that color in the QColorDialog, well (a) it shows as white, and (b) no matter what color you select, it won't DO anything because it's still set full-transparent.
So, long story short (to avoid burying the lead, but stay tuned for a fuller explanation):
We now have our own color picker, which does support transparency.
I hacked up a modified version of the QColorDialog that monkey-patches itself on opening, so I can replace the original
QColorShowLabel
widget with its ownCPAlphaLabel
which paints the selected color over the universal sign for transparency, the gray checkerboard pattern. (Oh, yes, and it also happens to be non-modal, which I think was the original goal. Honestly, I kind of lost track after I got hung up on the whole transparency thing.)This PR only checks in the ColorPicker implementation, it doesn't use it anywhere. That's for an upcoming PR. But I wanted to get the picker committed first.
The problem
Here's what I mean about the QColorDialog. Here's one of our title templates loaded into the Title Editor:
Go to edit the Background Color, you get this:
Change it to a nice light magenta / electric pink sort of color, you see this:
Click OK, and you end up with this:
Well, that's kind of a letdown. Enter the ColorPicker. Same initial setup, but when it opens you see this:
Change the color, and it changes to this:
It's only when you hike up the alpha channel that the color shows. Here's an alpha of 80 (~31% opaque):
And here's 192 (75% opaque):
Inspired by #3799 (but doesn't yet actually address anything requested there)