Small bugfix for menus on qt interface

git-svn-id: trunk@10534 -
This commit is contained in:
sekelsenmat 2007-01-29 21:36:52 +00:00
parent 8e29013693
commit eeab5cc377
2 changed files with 29 additions and 2 deletions

View File

@ -257,19 +257,35 @@ uses qtwidgets;
{ TQtAction } { TQtAction }
{------------------------------------------------------------------------------
Method: TQtAction.Create
Contructor for the class.
------------------------------------------------------------------------------}
constructor TQtAction.Create(const AHandle: QActionH); constructor TQtAction.Create(const AHandle: QActionH);
begin begin
Handle := AHandle; Handle := AHandle;
end; end;
{------------------------------------------------------------------------------
Method: TQtAction.Destroy
Destructor for the class.
------------------------------------------------------------------------------}
destructor TQtAction.Destroy; destructor TQtAction.Destroy;
begin begin
inherited Destroy; inherited Destroy;
end; end;
{------------------------------------------------------------------------------
Method: TQtAction.SlotTriggered
Callback for menu item click
------------------------------------------------------------------------------}
procedure TQtAction.SlotTriggered(checked: Boolean); cdecl; procedure TQtAction.SlotTriggered(checked: Boolean); cdecl;
begin begin
if Assigned(MenuItem) and Assigned(MenuItem.OnClick) then MenuItem.OnClick(Self); if Assigned(MenuItem) and Assigned(MenuItem.OnClick) then
MenuItem.OnClick(Self.MenuItem);
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -298,11 +314,17 @@ begin
QAction_setCheckable(Handle, p1); QAction_setCheckable(Handle, p1);
end; end;
{------------------------------------------------------------------------------
Method: TQtAction.setEnabled
------------------------------------------------------------------------------}
procedure TQtAction.setEnabled(p1: Boolean); procedure TQtAction.setEnabled(p1: Boolean);
begin begin
QAction_setEnabled(Handle, p1); QAction_setEnabled(Handle, p1);
end; end;
{------------------------------------------------------------------------------
Method: TQtAction.setVisible
------------------------------------------------------------------------------}
procedure TQtAction.setVisible(p1: Boolean); procedure TQtAction.setVisible(p1: Boolean);
begin begin
QAction_setVisible(Handle, p1); QAction_setVisible(Handle, p1);

View File

@ -235,13 +235,18 @@ begin
We can detect this menu item checking if HasParent is false } We can detect this menu item checking if HasParent is false }
if AMenuItem.HasParent then if AMenuItem.HasParent then
begin begin
{ Here the menu item has a QMenuH handle } { Here the menu item has a QMenuH handle
Obs: Commented because they cause access violations inside Qt
library on the Virtual Magnifying Glass }
if AMenuItem.Count > 0 then if AMenuItem.Count > 0 then
begin begin
// TQtMenu(AMenuItem.Handle).Free;
end end
{ Here the menu item has a QActionH handle } { Here the menu item has a QActionH handle }
else else
begin begin
// TQtAction(AMenuItem.Handle).Free;
end; end;
end; end;
end; end;