mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-10 21:30:35 +02:00
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:
parent
ff2de09e84
commit
9a0a3d9bfd
@ -148,6 +148,7 @@ const
|
||||
TargetEntrys = 3;
|
||||
QEventLCLMessage = QEventUser;
|
||||
LCLQt_CheckSynchronize = QEventType(Ord(QEventUser) + $1001);
|
||||
LCLQt_PopupMenuClose = QEventType(Ord(QEventUser) + $1002);
|
||||
|
||||
var
|
||||
QtWidgetSet: TQtWidgetSet;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user