mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-20 15:39:18 +02:00
qt: simplify code
git-svn-id: trunk@12262 -
This commit is contained in:
parent
392fe94bbb
commit
ef8fc0400f
@ -825,6 +825,7 @@ type
|
|||||||
private
|
private
|
||||||
FIcon: QIconH;
|
FIcon: QIconH;
|
||||||
FActionHook: QAction_hookH;
|
FActionHook: QAction_hookH;
|
||||||
|
FActionHandle: QActionH;
|
||||||
FMenuItem: TMenuItem;
|
FMenuItem: TMenuItem;
|
||||||
protected
|
protected
|
||||||
function CreateWidget(const APrams: TCreateParams): QWidgetH; override;
|
function CreateWidget(const APrams: TCreateParams): QWidgetH; override;
|
||||||
@ -5983,6 +5984,7 @@ function TQtMenu.CreateWidget(const APrams: TCreateParams): QWidgetH;
|
|||||||
begin
|
begin
|
||||||
FIcon := nil;
|
FIcon := nil;
|
||||||
Result := QMenu_create();
|
Result := QMenu_create();
|
||||||
|
FActionHandle := nil;;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TQtMenu.Create(const AMenuItem: TMenuItem);
|
constructor TQtMenu.Create(const AMenuItem: TMenuItem);
|
||||||
@ -6037,7 +6039,9 @@ end;
|
|||||||
|
|
||||||
function TQtMenu.actionHandle: QActionH;
|
function TQtMenu.actionHandle: QActionH;
|
||||||
begin
|
begin
|
||||||
Result := QMenu_menuAction(QMenuH(Widget));
|
if FActionHandle = nil then
|
||||||
|
FActionHandle := QMenu_menuAction(QMenuH(Widget));
|
||||||
|
Result := FActionHandle;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TQtMenu.addMenu(AMenu: QMenuH): QActionH;
|
function TQtMenu.addMenu(AMenu: QMenuH): QActionH;
|
||||||
@ -6068,8 +6072,7 @@ end;
|
|||||||
|
|
||||||
procedure TQtMenu.setChecked(p1: Boolean);
|
procedure TQtMenu.setChecked(p1: Boolean);
|
||||||
begin
|
begin
|
||||||
if p1 then setCheckable(True)
|
setCheckable(p1);
|
||||||
else setCheckable(False);
|
|
||||||
|
|
||||||
QAction_setChecked(ActionHandle, p1);
|
QAction_setChecked(ActionHandle, p1);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user