Qt: removed deffered deletion from qt44.

git-svn-id: trunk@18285 -
This commit is contained in:
zeljko 2009-01-14 07:46:21 +00:00
parent 862a8f9949
commit 26bf487d9a
4 changed files with 38 additions and 1 deletions

View File

@ -183,7 +183,7 @@ begin
{$IFDEF USE_QT_44}
{$note we must use QEventLoopDefferedDeletion because of SlotClose.
Normal forms are NOT closed without this ...}
QCoreApplication_processEvents(QEventLoopAllEvents or $10);
QCoreApplication_processEvents(QEventLoopAllEvents);
{$ELSE}
QCoreApplication_processEvents(QEventLoopAllEvents or QEventLoopDeferredDeletion);
{$ENDIF}

View File

@ -47,6 +47,9 @@ type
FInEventCount: Integer;
FReleaseInEvent: Boolean;
public
{$IFDEF USE_QT_44}
FDeleteLater: Boolean;
{$ENDIF}
FEventHook: QObject_hookH;
TheObject: QObjectH;
constructor Create; virtual; overload;
@ -706,6 +709,9 @@ end;
constructor TQtObject.Create;
begin
{$IFDEF USE_QT_44}
FDeleteLater := False;
{$ENDIF}
FEventHook := nil;
FUpdateCount := 0;
FInEventCount := 0;
@ -716,9 +722,17 @@ destructor TQtObject.Destroy;
begin
if TheObject <> nil then
begin
{$IFDEF USE_QT_44}
DetachEvents;
if FDeleteLater then
QObject_deleteLater(TheObject)
else
QObject_destroy(TheObject);
{$ELSE}
QCoreApplication_removePostedEvents(TheObject);
DetachEvents;
QObject_deleteLater(TheObject);
{$ENDIF}
TheObject := nil;
end;
inherited Destroy;
@ -3328,6 +3342,9 @@ constructor TQtTimer.CreateTimer(Interval: integer;
const TimerFunc: TFNTimerProc; App: QObjectH);
begin
inherited Create;
{$IFDEF USE_QT_44}
FDeleteLater := True;
{$ENDIF}
FAppObject := App;
FCallbackFunc := TimerFunc;
@ -3374,6 +3391,9 @@ end;
procedure TQtTimer.DetachEvents;
begin
{$IFDEF USE_QT_44}
QTimer_stop(QTimerH(TheObject));
{$ENDIF}
if FTimerHook <> nil then
QTimer_hook_destroy(FTimerHook);
inherited DetachEvents;

View File

@ -3562,7 +3562,14 @@ end;
procedure TQtWidget.DestroyWidget;
begin
if (Widget <> nil) and FOwnWidget then
begin
{$IFDEF USE_QT_44}
if not FDeleteLater then
QWidget_destroy(Widget)
else
{$ENDIF}
QObject_deleteLater(Widget);
end;
Widget := nil;
end;
@ -3967,6 +3974,9 @@ begin
QLayout_addWidget(LayoutWidget, FCentralWidget);
QWidget_setLayout(Result, QLayoutH(LayoutWidget));
{$IFDEF USE_QT_44}
QWidget_setAttribute(Result, QtWA_DeleteOnClose);
{$ENDIF}
end;
QWidget_setAttribute(Result, QtWA_NoMousePropagation);
@ -7933,7 +7943,11 @@ end;
procedure TQtMenu.SlotAboutToHide; cdecl;
begin
if FMenuItem.Menu is TPopupMenu then
{$IFDEF USE_QT_44}
DoPopupClose;
{$ELSE}
QCoreApplication_postEvent(Widget, QEvent_create(LCLQt_PopupMenuClose));
{$ENDIF}
end;
procedure TQtMenu.DoPopupClose;

View File

@ -365,6 +365,9 @@ begin
else if (AMenu is TPopUpMenu) then
begin
Menu := TQtMenu.Create(AMenu.Items);
{$IFDEF USE_QT_44}
Menu.FDeleteLater := True;
{$ENDIF}
//Menu.setParent(Parent);
Menu.AttachEvents;