qt: The OnClose event of TPopupMenu is not fired when is closed (part of 0009436)

git-svn-id: trunk@13958 -
This commit is contained in:
paul 2008-02-03 08:28:25 +00:00
parent ff2de09e84
commit 9a0a3d9bfd
3 changed files with 17 additions and 2 deletions

View File

@ -148,6 +148,7 @@ const
TargetEntrys = 3;
QEventLCLMessage = QEventUser;
LCLQt_CheckSynchronize = QEventType(Ord(QEventUser) + $1001);
LCLQt_PopupMenuClose = QEventType(Ord(QEventUser) + $1002);
var
QtWidgetSet: TQtWidgetSet;

View File

@ -901,6 +901,7 @@ type
FMenuItem: TMenuItem;
protected
function CreateWidget(const APrams: TCreateParams): QWidgetH; override;
procedure DoPopupClose;
public
constructor Create(const AMenuItem: TMenuItem); overload;
destructor Destroy; override;
@ -6524,9 +6525,16 @@ begin
end;
procedure TQtMenu.SlotAboutToHide; cdecl;
var
Event: QEventH;
begin
// only for debug some staff
// DumpStack;
if FMenuItem.Menu is TPopupMenu then
QCoreApplication_postEvent(Widget, QEvent_create(LCLQt_PopupMenuClose));
end;
procedure TQtMenu.DoPopupClose;
begin
TPopupMenu(FMenuItem.Menu).Close;
end;
procedure TQtMenu.SlotDestroy; cdecl;
@ -6655,6 +6663,11 @@ begin
Result := False;
case QEvent_type(Event) of
LCLQt_PopupMenuClose:
begin
DoPopupClose;
Result := True;
end;
QEventDestroy: SlotDestroy;
end;
EndEventProcessing;

View File

@ -231,6 +231,7 @@ type
property Handle: HMenu read GetHandle write FHandle;
property Items[Index: Integer]: TMenuItem read GetItem; default;
property MenuIndex: Integer read GetMenuIndex write SetMenuIndex;
property Menu: TMenu read FMenu;
property Parent: TMenuItem read GetParent;
property Command: integer read FCommand;
function MenuVisibleIndex: integer;