mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-01 07:00:32 +02:00
Qt: set proper text palette when control is disabled and regular font.color <> clDefault.issue #25922
git-svn-id: trunk@44541 -
This commit is contained in:
parent
b60a8b420e
commit
0b82d8141f
@ -422,6 +422,7 @@ var
|
||||
AQColor, AOldColor: TQColor;
|
||||
B: Boolean;
|
||||
OldCanvasFontColor: TColor;
|
||||
APalette: QPaletteH;
|
||||
begin
|
||||
B := False;
|
||||
|
||||
@ -431,10 +432,25 @@ begin
|
||||
B := True;
|
||||
AOldColor := TQtDeviceContext(TCanvas(ACanvas).Handle).pen.getColor;
|
||||
OldCanvasFontColor := TCanvas(ACanvas).Font.Color;
|
||||
if TCanvas(ACanvas).Font.Color = clDefault then
|
||||
TCanvas(ACanvas).Font.Color := clBtnText;
|
||||
ColorRefToTQColor(ColorToRGB(TCanvas(ACanvas).Font.Color), AQColor);
|
||||
TQtDeviceContext(TCanvas(ACanvas).Handle).pen.setColor(AQColor);
|
||||
|
||||
// issue #25922
|
||||
if IsDisabled(Details) then
|
||||
begin
|
||||
APalette := QPalette_create;
|
||||
try
|
||||
QApplication_palette(APalette,'QPushButton');
|
||||
AQColor := QPalette_color(APalette, QPaletteDisabled, QPaletteButtonText)^;
|
||||
TQtDeviceContext(TCanvas(ACanvas).Handle).pen.setColor(AQColor);
|
||||
finally
|
||||
QPalette_destroy(APalette);
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
if TCanvas(ACanvas).Font.Color = clDefault then
|
||||
TCanvas(ACanvas).Font.Color := clBtnText;
|
||||
ColorRefToTQColor(ColorToRGB(TCanvas(ACanvas).Font.Color), AQColor);
|
||||
TQtDeviceContext(TCanvas(ACanvas).Handle).pen.setColor(AQColor);
|
||||
end;
|
||||
end;
|
||||
|
||||
DrawText(TCanvas(ACanvas).Handle, Details, S, R, Flags, Flags2);
|
||||
|
@ -2388,6 +2388,15 @@ begin
|
||||
if PtInRect(R, QtWidgetSet.GetWidgetAtCachePoint) then
|
||||
QtWidgetSet.InvalidateWidgetAtCache;
|
||||
end;
|
||||
// issue #25922
|
||||
if Assigned(FPalette) and Assigned(LCLObject) then
|
||||
begin
|
||||
// DebugLn('QEventEnabledChange: ',dbgsName(LCLObject),' enabled ',dbgs(getEnabled));
|
||||
if not getEnabled then
|
||||
Palette.setTextColor(@Palette.DisabledTextColor)
|
||||
else
|
||||
setInitialFontColor(LCLObject);
|
||||
end;
|
||||
end;
|
||||
QEventShow:
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user