mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 08:20:19 +02:00
qt: edit: force show texthint in ShowHide. issue #32053
git-svn-id: trunk@55718 -
This commit is contained in:
parent
2fef454a77
commit
b1582463a2
@ -29,7 +29,7 @@ uses
|
||||
// RTL
|
||||
math,
|
||||
// LCL
|
||||
Classes, Types, StdCtrls, Controls, Forms, SysUtils, InterfaceBase, LCLType,
|
||||
Classes, Types, Graphics, StdCtrls, Controls, Forms, SysUtils, InterfaceBase, LCLType,
|
||||
// Widgetset
|
||||
WSProc, WSStdCtrls, WSLCLClasses;
|
||||
|
||||
@ -154,6 +154,7 @@ type
|
||||
class function GetSelLength(const ACustomEdit: TCustomEdit): integer; override;
|
||||
class procedure SetSelStart(const ACustomEdit: TCustomEdit; NewStart: integer); override;
|
||||
class procedure SetSelLength(const ACustomEdit: TCustomEdit; NewLength: integer); override;
|
||||
class procedure ShowHide(const AWinControl: TWinControl); override;
|
||||
|
||||
//class procedure SetPasswordChar(const ACustomEdit: TCustomEdit; NewChar: char); override;
|
||||
class procedure Cut(const ACustomEdit: TCustomEdit); override;
|
||||
@ -265,6 +266,14 @@ type
|
||||
published
|
||||
end;
|
||||
|
||||
{ TEditHelper }
|
||||
|
||||
TEditHelper = class helper for TCustomEdit
|
||||
public
|
||||
function EmulatedTextHintStatus: TCustomEdit.TEmulatedTextHintStatus;
|
||||
function CreateEmulatedTextHintFont: TFont;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
uses qtint;
|
||||
@ -291,6 +300,18 @@ const
|
||||
QFrameSunken
|
||||
);
|
||||
|
||||
{ TEditHelper }
|
||||
|
||||
function TEditHelper.EmulatedTextHintStatus: TCustomEdit.TEmulatedTextHintStatus;
|
||||
begin
|
||||
Result := FEmulatedTextHintStatus;
|
||||
end;
|
||||
|
||||
function TEditHelper.CreateEmulatedTextHintFont: TFont;
|
||||
begin
|
||||
Result := inherited CreateEmulatedTextHintFont;
|
||||
end;
|
||||
|
||||
|
||||
{ TQtWSScrollBar }
|
||||
|
||||
@ -1030,6 +1051,31 @@ begin
|
||||
QtEdit.setSelection(AStart, NewLength);
|
||||
end;
|
||||
|
||||
class procedure TQtWSCustomEdit.ShowHide(const AWinControl: TWinControl);
|
||||
var
|
||||
Widget: TQtWidget;
|
||||
EditFont: TFont;
|
||||
begin
|
||||
if not WSCheckHandleAllocated(AWincontrol, 'ShowHide') then
|
||||
Exit;
|
||||
|
||||
Widget := TQtWidget(AWinControl.Handle);
|
||||
Widget.BeginUpdate;
|
||||
|
||||
TQtWSWinControl.ShowHide(AWinControl);
|
||||
if AWinControl.HandleObjectShouldBeVisible
|
||||
and (TCustomEdit(AWinControl).EmulatedTextHintStatus=thsShowing) then
|
||||
begin
|
||||
EditFont := TCustomEdit(AWinControl).CreateEmulatedTextHintFont;
|
||||
try
|
||||
SetFont(AWinControl, EditFont);
|
||||
finally
|
||||
EditFont.Free;
|
||||
end;
|
||||
end;
|
||||
Widget.EndUpdate;
|
||||
end;
|
||||
|
||||
class procedure TQtWSCustomEdit.Cut(const ACustomEdit: TCustomEdit);
|
||||
var
|
||||
Widget: TQtWidget;
|
||||
|
Loading…
Reference in New Issue
Block a user