diff --git a/lcl/interfaces/qt/qtthemes.pas b/lcl/interfaces/qt/qtthemes.pas index a75675b6d5..a8af3de8f5 100644 --- a/lcl/interfaces/qt/qtthemes.pas +++ b/lcl/interfaces/qt/qtthemes.pas @@ -421,19 +421,29 @@ procedure TQtThemeServices.DrawText(ACanvas: TPersistent; var AQColor, AOldColor: TQColor; B: Boolean; + OldCanvasFontColor: TColor; begin B := False; - if (TCanvas(ACanvas).Font.Color <> clDefault) then + + // issue #25253 + if (Details.Element in [teButton, teComboBox]) then begin - // issue #25253 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); end; + DrawText(TCanvas(ACanvas).Handle, Details, S, R, Flags, Flags2); + if B then + begin TQtDeviceContext(TCanvas(ACanvas).Handle).pen.setColor(AOldColor); + TCanvas(ACanvas).Font.Color := OldCanvasFontColor; + end; end; procedure TQtThemeServices.DrawText(DC: HDC; Details: TThemedElementDetails; @@ -556,7 +566,9 @@ begin QApplication_palette(Palette); end; try - AQColor := TQtDeviceContext(DC).pen.getColor; // issue #25253 + if Details.Element in [teButton, teComboBox] then + AQColor := TQtDeviceContext(DC).pen.getColor; // issue #25253 + if Details.Element in [teEdit, teListView, teTreeView, teWindow] then ATextPalette := QPaletteWindowText else @@ -565,7 +577,8 @@ begin else ATextPalette := QPaletteText; - QPalette_setColor(Palette, ATextPalette, @AQColor); // issue #25253 + if Details.Element in [teButton, teComboBox] then + QPalette_setColor(Palette, ATextPalette, @AQColor); // issue #25253 QStyle_drawItemText(Style, Context.Widget, @R, DTFlagsToQtFlags(Flags), Palette,