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 }
{------------------------------------------------------------------------------
Method: TQtAction.Create
Contructor for the class.
------------------------------------------------------------------------------}
constructor TQtAction.Create(const AHandle: QActionH);
begin
Handle := AHandle;
end;
{------------------------------------------------------------------------------
Method: TQtAction.Destroy
Destructor for the class.
------------------------------------------------------------------------------}
destructor TQtAction.Destroy;
begin
inherited Destroy;
end;
{------------------------------------------------------------------------------
Method: TQtAction.SlotTriggered
Callback for menu item click
------------------------------------------------------------------------------}
procedure TQtAction.SlotTriggered(checked: Boolean); cdecl;
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;
{------------------------------------------------------------------------------
@ -298,11 +314,17 @@ begin
QAction_setCheckable(Handle, p1);
end;
{------------------------------------------------------------------------------
Method: TQtAction.setEnabled
------------------------------------------------------------------------------}
procedure TQtAction.setEnabled(p1: Boolean);
begin
QAction_setEnabled(Handle, p1);
end;
{------------------------------------------------------------------------------
Method: TQtAction.setVisible
------------------------------------------------------------------------------}
procedure TQtAction.setVisible(p1: Boolean);
begin
QAction_setVisible(Handle, p1);

View File

@ -235,13 +235,18 @@ begin
We can detect this menu item checking if HasParent is false }
if AMenuItem.HasParent then
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
begin
// TQtMenu(AMenuItem.Handle).Free;
end
{ Here the menu item has a QActionH handle }
else
begin
// TQtAction(AMenuItem.Handle).Free;
end;
end;
end;