Qt: workaround for Qt lib bug (QStyle) where disabled button doesn't have activated disabled colors palette. issue #24413

git-svn-id: trunk@41144 -
This commit is contained in:
zeljko 2013-05-12 08:28:11 +00:00
parent 910bf5ba13
commit 8a5bc81356

View File

@ -134,6 +134,7 @@ var
ClipR: TRect; // fix branch indicators (treeviews)
{$ENDIF}
dx, dy: integer;
APalette: QPaletteH;
begin
if (Context <> nil) then
begin
@ -178,6 +179,21 @@ begin
if Details.Element = teToolBar then
Features := Features or QStyleOptionButtonFlat;
QStyleOptionButton_setFeatures(QStyleOptionButtonH(opt), Features);
// workaround for qt QStyle bug. QStyle does not set disable flag (palette).
// see issue #24413
if Details.State in [TS_DISABLED] then
begin
APalette := QPalette_create();
try
QStyleOption_palette(opt, APalette);
QPalette_setCurrentColorGroup(APalette, QPaletteDisabled);
QStyleOption_setPalette(opt, APalette);
finally
QPalette_destroy(APalette);
end;
end;
end
else
if (Element.ControlElement = QStyleCE_HeaderSection) then