Qt5,Qt6: Seem that QEventDestroy does not work anymore for qt5 and qt6. issue #41433

This commit is contained in:
zeljan1 2025-02-15 17:36:19 +01:00
parent 740f63fe4c
commit df31c25382
2 changed files with 20 additions and 30 deletions

View File

@ -671,7 +671,6 @@ type
ScrollArea: TQtWindowArea;
{$ENDIF}
destructor Destroy; override;
procedure Destroyed; cdecl; override;
procedure BeginUpdate; override;
procedure EndUpdate; override;
@ -2381,7 +2380,17 @@ begin
end;
procedure TQtWidget.Destroyed; cdecl;
var
Msg: TLMessage;
begin
//QEventDestroy does not trigger in Qt5 and Qt6 so we must finish here.
//see issue #41433.
if Assigned(LCLObject) then
begin
FillChar(Msg{%H-}, SizeOf(Msg), #0);
Msg.Msg := LM_DESTROY;
DeliverMessage(Msg);
end;
Widget := nil;
Release;
end;
@ -7418,20 +7427,6 @@ begin
inherited Destroy;
end;
procedure TQtMainWindow.Destroyed; cdecl;
begin
//this is event from qt, must inform LCL about it. issue #41433
//when non modal popup is shown over modal form and modal form = real popup parent
//if popup form, and modal form is closed on button close then qt releases
//popup form automatically, so all we have todo is inform LCL.
if Assigned(LCLObject) and (LCLObject.Parent = nil) and not IsMdiChild then
begin
Widget := nil;
SlotDestroy;
end else
inherited Destroyed;
end;
procedure TQtMainWindow.BeginUpdate;
begin
inherited BeginUpdate;

View File

@ -669,7 +669,6 @@ type
ScrollArea: TQtWindowArea;
{$ENDIF}
destructor Destroy; override;
procedure Destroyed; cdecl; override;
procedure BeginUpdate; override;
procedure EndUpdate; override;
@ -2378,7 +2377,17 @@ begin
end;
procedure TQtWidget.Destroyed; cdecl;
var
Msg: TLMessage;
begin
//QEventDestroy does not trigger in Qt5 and Qt6 so we must finish here.
//see issue #41433.
if Assigned(LCLObject) then
begin
FillChar(Msg{%H-}, SizeOf(Msg), #0);
Msg.Msg := LM_DESTROY;
DeliverMessage(Msg);
end;
Widget := nil;
Release;
end;
@ -7369,20 +7378,6 @@ begin
inherited Destroy;
end;
procedure TQtMainWindow.Destroyed; cdecl;
begin
//this is event from qt, must inform LCL about it. issue #41433
//when non modal popup is shown over modal form and modal form = real popup parent
//if popup form, and modal form is closed on button close then qt releases
//popup form automatically, so all we have todo is inform LCL.
if Assigned(LCLObject) and (LCLObject.Parent = nil) and not IsMdiChild then
begin
Widget := nil;
SlotDestroy;
end else
inherited Destroyed;
end;
procedure TQtMainWindow.BeginUpdate;
begin
inherited BeginUpdate;