-
Notifications
You must be signed in to change notification settings - Fork 3k
Fix #13652: Show opacity control in color picker where appropriate #16201
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
Fix #13652: Show opacity control in color picker where appropriate #16201
Conversation
issue_13652_fix.mp4 |
|
Is there a way for me to add a checkbox to QColorDialog to enable or disable checkbox? When I first tackled this issue I couldn't find the qml for QColorDialog and soon realized it's an inbuit component and never really looked into editing the dialog's UI. |
|
@octopols What do you mean? The color dialog is platform-dependent, i.e. Qt just calls the OS's color dialog. That means that you don't have any possibilities to customise it, beyond the options offered by Qt. |
cbjeukendrup
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see one issue with this PR: probably not every color picker should have an alpha channel. For example, I think the color pickers in Preferences > Appearance should not have an alpha channel, because that may cause strange results.
So I think you need to add a property to the ColorPicker component in QML to enable/disable the alpha channel per instance of ColorPicker. Then, you need to propagate the value of that property via ColorPickerModel to Interactive::selectColor, which should get a new parameter for that. Then, based on that parameter, you should pass QColorDialog::ShowAlphaChannel or QColorDialog::ColorDialogOptions() to the QColorDialog.
|
I was discussing this issue with @VanSHOE recently, and he suggested editing it through Qt Quick components. However, I'm not entirely sure if I conveyed my problem correctly to him. |
|
I'm afraid yes... I would prefer to use the platform dialogs as much as we can, because they "just work" and people already know them from other apps. |
|
@cbjeukendrup I'm having a really hard time propagating a bool I created |
|
That list of files looks good. The "missing link" will indeed be in |
|
Ah, the problem is that That method is called here: QtObject {
id: prv
function selectColor() {
var selectedColor = colorPickerModel.selectColor(root.color) // <-- here
root.newColorSelected(selectedColor)
}
}So in that place, you need to pass the showAlpha parameter. |
|
There are two solutions:
|
|
Thank you very much for your help. The issue has been resolved now. |
fe67b8f to
5b88118
Compare
|
Sorry if this was already obvious to everyone else, but in case it's useful or relevant - I just realized, the alpha channel control already is present if you involve the color picker from the Format / Style / Text Styles. Which is great, because that's where it is actually needed most. But of course, it would be great to have in Properties as well |
|
Rebase needed |
I'll rebase it today, sorry for replying late |
fa1f8d3 to
525a11a
Compare
5b88118 to
1fac39a
Compare
1fac39a to
8942698
Compare
|
@zacjansheski please check that the colour pickers in the properties panel now have a (working) alpha channel, i.e. the one inside the Appearance popup, and the ones for text border / fill. |
|
I'm unable to open these builds, tried on both MacOS and Windows. Splash screen and then MSS crashes. @cbjeukendrup please advise |
- `IInteractive::selectColor` gets an `allowAlpha` parameter
- `ColorPicker` gets a property whose value is passed to this new parameter
- When alpha is 0 and the color dialog is launched, the alpha is changed to 255 in the color dialog, to prevent confusion ("Hm, I chose a color but I still see nothing...")
Co-Authored-By: Casper Jeukendrup <[email protected]>
8942698 to
3518ff3
Compare
|
It turns out I had not properly removed a change from an old version of this PR... should be fixed now! |
|
Tested on MacOS 15, Windows 11. Approved |
|
Backporting to 4.6.4? |
|
Hm... yeah, I'm not against. |
|
Done, see #30918 |





Resolves: #13652
Color picker now have alpha value. If the alpha value is 0 and the color picker is launched the value is changed to 255 automatically.
Sorry I had to close the last PR fixing this issue because of me deleting my original fork.
This PR is a replacement for #16103 .