mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-04 19:18:19 +02:00
Qt5: implemented themed draw of teEdit
git-svn-id: trunk@62223 -
This commit is contained in:
parent
5973af4f9d
commit
c215455679
@ -438,6 +438,10 @@ begin
|
||||
begin
|
||||
opt := QStyleOptionFrame_create();
|
||||
end;
|
||||
QStylePE_FrameLineEdit:
|
||||
begin
|
||||
opt := QStyleOptionFrame_create();
|
||||
end;
|
||||
QStylePE_IndicatorBranch:
|
||||
begin
|
||||
|
||||
@ -620,6 +624,9 @@ begin
|
||||
Context.save;
|
||||
try
|
||||
Context.SetBkMode(TRANSPARENT);
|
||||
if Details.State = TREIS_DISABLED then
|
||||
QPalette_setCurrentColorGroup(Palette, QPaletteDisabled)
|
||||
else
|
||||
if Details.State = TREIS_SELECTEDNOTFOCUS then
|
||||
QPalette_setCurrentColorGroup(Palette, QPaletteInactive)
|
||||
else
|
||||
@ -696,6 +703,12 @@ begin
|
||||
OffsetRect(R, -R.Left, -R.Top);
|
||||
end;
|
||||
|
||||
if (Details.Element = teEdit) then
|
||||
begin
|
||||
if IsDisabled(Details) then
|
||||
QPalette_setCurrentColorGroup(Palette, QPaletteDisabled);
|
||||
end;
|
||||
|
||||
QStyle_drawItemText(Style, Context.Widget, @R,
|
||||
DTFlagsToQtFlags(Flags), Palette,
|
||||
not IsDisabled(Details), @W, ATextPalette);
|
||||
@ -829,6 +842,20 @@ begin
|
||||
Result := Result or QStyleState_Active or QStyleState_HasFocus or QStyleState_MouseOver;
|
||||
end;
|
||||
end;
|
||||
if (Details.Element = teEdit) and (Details.Part in [EP_EDITTEXT, EP_BACKGROUND, EP_BACKGROUNDWITHBORDER]) then
|
||||
begin
|
||||
if Details.State = ETS_FOCUSED then
|
||||
Result := Result or QStyleState_Active or QStyleState_Enabled or QStyleState_HasFocus;
|
||||
|
||||
if Details.State = ETS_HOT then
|
||||
Result := Result or QStyleState_MouseOver
|
||||
else
|
||||
if Details.State = ETS_READONLY then
|
||||
Result := Result or QStyleState_ReadOnly
|
||||
else
|
||||
if Details.State = ETS_SELECTED then
|
||||
Result := Result or QStyleState_Selected;
|
||||
end;
|
||||
if (Details.Element = teWindow) then
|
||||
begin
|
||||
if Details.Part in [WP_SMALLCAPTION,
|
||||
@ -1088,6 +1115,12 @@ begin
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
teEdit:
|
||||
begin
|
||||
Result.DrawVariant := qdvPrimitive;
|
||||
if Details.Part in [0, EP_EDITTEXT, EP_CARET, EP_BACKGROUND, EP_BACKGROUNDWITHBORDER] then
|
||||
Result.PrimitiveElement := QStylePE_FrameLineEdit;
|
||||
end;
|
||||
teSpin:
|
||||
begin
|
||||
Result.DrawVariant := qdvComplexControl;
|
||||
|
Loading…
Reference in New Issue
Block a user