Skip to content

Commit 81ae758

Browse files
committed
fix: preserve Qt tree subclass with standard LFM classes
1 parent 9e682a1 commit 81ae758

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

source/lazaruscompat.pas

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface
1414
Classes, SysUtils, SynEdit, SynEditKeyCmds, SynEditHighlighter, laz.VirtualTrees,
1515
Graphics, SynCompletion, Types
1616
{$IFDEF HEIDI_LINUX_QT}
17-
, Forms, LMessages
17+
, Forms, LMessages, LResources
1818
{$ENDIF};
1919

2020
type
@@ -52,6 +52,14 @@ THeidiVirtualStringTree = class(TLazVirtualStringTree)
5252
{$ENDIF}
5353
end;
5454

55+
{$IFDEF HEIDI_LINUX_QT}
56+
THeidiLRSObjectReader = class(TLRSObjectReader)
57+
public
58+
procedure BeginComponent(var Flags: TFilerFlags; var AChildPos: Integer;
59+
var CompClassName, CompName: String); override;
60+
end;
61+
{$ENDIF}
62+
5563
TProgressBarState = (pbsNormal, pbsError, pbsPaused);
5664

5765
// Add methods which exist in Delphi but not in Lazarus
@@ -216,6 +224,15 @@ implementation
216224
{$IFDEF HEIDI_LINUX_QT}
217225
uses
218226
Math, LazUTF8;
227+
228+
procedure THeidiLRSObjectReader.BeginComponent(var Flags: TFilerFlags;
229+
var AChildPos: Integer; var CompClassName, CompName: String);
230+
begin
231+
inherited BeginComponent(Flags, AChildPos, CompClassName, CompName);
232+
if CompClassName = 'TLazVirtualStringTree' then
233+
CompClassName := THeidiVirtualStringTree.ClassName;
234+
end;
235+
219236
const
220237
QtHintInitialPauseMs = 250;
221238
QtHintKeepAliveMs = 24 * 60 * 60 * 1000;
@@ -571,8 +588,7 @@ function TStringsHelper.IsEmpty: Boolean;
571588
initialization
572589
{$IFDEF HEIDI_LINUX_QT}
573590
RegisterClass(THeidiVirtualStringTree);
574-
UnRegisterClass(TLazVirtualStringTree);
575-
RegisterClassAlias(THeidiVirtualStringTree, 'TLazVirtualStringTree');
591+
LRSObjectReaderClass := THeidiLRSObjectReader;
576592
{$ENDIF}
577593

578594
end.

0 commit comments

Comments
 (0)