mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 01:19:16 +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;
|
TargetEntrys = 3;
|
||||||
QEventLCLMessage = QEventUser;
|
QEventLCLMessage = QEventUser;
|
||||||
LCLQt_CheckSynchronize = QEventType(Ord(QEventUser) + $1001);
|
LCLQt_CheckSynchronize = QEventType(Ord(QEventUser) + $1001);
|
||||||
|
LCLQt_PopupMenuClose = QEventType(Ord(QEventUser) + $1002);
|
||||||
|
|
||||||
var
|
var
|
||||||
QtWidgetSet: TQtWidgetSet;
|
QtWidgetSet: TQtWidgetSet;
|
||||||
|
@ -901,6 +901,7 @@ type
|
|||||||
FMenuItem: TMenuItem;
|
FMenuItem: TMenuItem;
|
||||||
protected
|
protected
|
||||||
function CreateWidget(const APrams: TCreateParams): QWidgetH; override;
|
function CreateWidget(const APrams: TCreateParams): QWidgetH; override;
|
||||||
|
procedure DoPopupClose;
|
||||||
public
|
public
|
||||||
constructor Create(const AMenuItem: TMenuItem); overload;
|
constructor Create(const AMenuItem: TMenuItem); overload;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -6524,9 +6525,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TQtMenu.SlotAboutToHide; cdecl;
|
procedure TQtMenu.SlotAboutToHide; cdecl;
|
||||||
|
var
|
||||||
|
Event: QEventH;
|
||||||
begin
|
begin
|
||||||
// only for debug some staff
|
if FMenuItem.Menu is TPopupMenu then
|
||||||
// DumpStack;
|
QCoreApplication_postEvent(Widget, QEvent_create(LCLQt_PopupMenuClose));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TQtMenu.DoPopupClose;
|
||||||
|
begin
|
||||||
|
TPopupMenu(FMenuItem.Menu).Close;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TQtMenu.SlotDestroy; cdecl;
|
procedure TQtMenu.SlotDestroy; cdecl;
|
||||||
@ -6655,6 +6663,11 @@ begin
|
|||||||
Result := False;
|
Result := False;
|
||||||
|
|
||||||
case QEvent_type(Event) of
|
case QEvent_type(Event) of
|
||||||
|
LCLQt_PopupMenuClose:
|
||||||
|
begin
|
||||||
|
DoPopupClose;
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
QEventDestroy: SlotDestroy;
|
QEventDestroy: SlotDestroy;
|
||||||
end;
|
end;
|
||||||
EndEventProcessing;
|
EndEventProcessing;
|
||||||
|
@ -231,6 +231,7 @@ type
|
|||||||
property Handle: HMenu read GetHandle write FHandle;
|
property Handle: HMenu read GetHandle write FHandle;
|
||||||
property Items[Index: Integer]: TMenuItem read GetItem; default;
|
property Items[Index: Integer]: TMenuItem read GetItem; default;
|
||||||
property MenuIndex: Integer read GetMenuIndex write SetMenuIndex;
|
property MenuIndex: Integer read GetMenuIndex write SetMenuIndex;
|
||||||
|
property Menu: TMenu read FMenu;
|
||||||
property Parent: TMenuItem read GetParent;
|
property Parent: TMenuItem read GetParent;
|
||||||
property Command: integer read FCommand;
|
property Command: integer read FCommand;
|
||||||
function MenuVisibleIndex: integer;
|
function MenuVisibleIndex: integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user