QT5: implement TColorDialog.AlphaChannel and associated TColorDialogOption cdShowAlphaChannel.

This commit is contained in:
Bart 2024-12-14 16:49:48 +01:00
parent b511c5cafa
commit 8fd7e96fa5

View File

@ -901,7 +901,7 @@ var
begin
AColor := ColorToRgb(ColorDialog.Color);
AQColor.Alpha := $FFFF;
AQColor.Alpha := Word(ColorDialog.AlphaChannel) * $0101;
AQColor.ColorSpec := 1;
AQColor.Pad := 0;
ColorRefToTQColor(AColor, AQColor);
@ -915,6 +915,8 @@ begin
ATitle := UTF8ToUTF16(ACommonDialog.Title);
AQColorRet := Default(TQColor);
AOptions := 0; // here we add possible options from ColorDialog.Options, see QColorDialogColorDialogOptions for possible options.
if (cdShowAlphaChannel in ColorDialog.Options) then
AOptions := AOptions or QColorDialogShowAlphaChannel;
QColorDialog_getColor(PQColor(@AQColorRet), PQColor(@AQColor), TQtWSCommonDialog.GetDialogParent(ACommonDialog), @ATitle, AOptions);
ReturnBool := AQColorRet.ColorSpec <> 0;
@ -923,6 +925,7 @@ begin
begin
TQColorToColorRef(AQColorRet, AColor);
ColorDialog.Color := AColor;
ColorDialog.AlphaChannel := AQColorRet.Alpha and $FF;
ColorDialog.UserChoice := mrOk
end else
ColorDialog.UserChoice := mrCancel;