mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-10 02:38:12 +02:00
- fixing "point" issues (change from PPoint to PQtPoint)
- fixing lazarus splash screen launch (there was assumption in the code that application already has MainForm, so all calls like Application.MainForm.Visible causes AV) - fixing issues with Menu git-svn-id: trunk@11448 -
This commit is contained in:
parent
92017a02c7
commit
abc335dd5a
@ -1172,8 +1172,12 @@ end;
|
|||||||
Returns: Nothing
|
Returns: Nothing
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TQtDeviceContext.brushOrigin(retval: PPoint);
|
procedure TQtDeviceContext.brushOrigin(retval: PPoint);
|
||||||
|
var
|
||||||
|
QtPoint: TQtPoint;
|
||||||
begin
|
begin
|
||||||
QPainter_brushOrigin(Widget, retval);
|
QPainter_brushOrigin(Widget, @QtPoint);
|
||||||
|
retval^.x := QtPoint.x;
|
||||||
|
retval^.y := QtPoint.y;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
|
@ -503,17 +503,25 @@ type
|
|||||||
TQtMenu = class(TQtWidget)
|
TQtMenu = class(TQtWidget)
|
||||||
private
|
private
|
||||||
FIcon: QIconH;
|
FIcon: QIconH;
|
||||||
|
public
|
||||||
|
MenuItem: TMenuItem;
|
||||||
public
|
public
|
||||||
constructor Create(const AParent: QWidgetH); overload;
|
constructor Create(const AParent: QWidgetH); overload;
|
||||||
constructor Create(const AHandle: QMenuH); overload;
|
constructor Create(const AHandle: QMenuH); overload;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
public
|
public
|
||||||
procedure PopUp(pos: PPoint; at: QActionH = nil);
|
procedure SlotTriggered(checked: Boolean = False); cdecl;
|
||||||
function addAction(text: PWideString): TQtAction;
|
public
|
||||||
|
procedure PopUp(pos: PQtPoint; at: QActionH = nil);
|
||||||
|
function actionHandle: QActionH;
|
||||||
function addMenu(title: PWideString): TQtMenu;
|
function addMenu(title: PWideString): TQtMenu;
|
||||||
function addSeparator: TQtAction;
|
function addSeparator: TQtMenu;
|
||||||
|
procedure setChecked(p1: Boolean);
|
||||||
|
procedure setCheckable(p1: Boolean);
|
||||||
|
procedure setHasSubmenu(AValue: Boolean);
|
||||||
procedure setIcon(AIcon: QIconH);
|
procedure setIcon(AIcon: QIconH);
|
||||||
procedure setImage(AImage: TQtImage);
|
procedure setImage(AImage: TQtImage);
|
||||||
|
procedure setSeparator(AValue: Boolean);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TQtMenuBar }
|
{ TQtMenuBar }
|
||||||
@ -524,9 +532,8 @@ type
|
|||||||
constructor Create(const AParent: QWidgetH); overload;
|
constructor Create(const AParent: QWidgetH); overload;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
public
|
public
|
||||||
function addAction(text: PWideString): TQtAction;
|
|
||||||
function addMenu(title: PWideString): TQtMenu;
|
function addMenu(title: PWideString): TQtMenu;
|
||||||
function addSeparator: TQtAction;
|
function addSeparator: TQtMenu;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TQtProgressBar }
|
{ TQtProgressBar }
|
||||||
@ -1039,7 +1046,7 @@ end;
|
|||||||
procedure TQtWidget.SlotMouse(Event: QEventH); cdecl;
|
procedure TQtWidget.SlotMouse(Event: QEventH); cdecl;
|
||||||
var
|
var
|
||||||
Msg: TLMMouse;
|
Msg: TLMMouse;
|
||||||
MousePos: TPoint;
|
MousePos: PQtPoint;
|
||||||
Mbutton: QTMouseButtons;
|
Mbutton: QTMouseButtons;
|
||||||
Modifiers: QtKeyboardModifiers;
|
Modifiers: QtKeyboardModifiers;
|
||||||
begin
|
begin
|
||||||
@ -1049,7 +1056,7 @@ begin
|
|||||||
|
|
||||||
FillChar(Msg, SizeOf(Msg), #0);
|
FillChar(Msg, SizeOf(Msg), #0);
|
||||||
|
|
||||||
QMouseEvent_pos(QMouseEventH(Event), @MousePos);
|
MousePos := QMouseEvent_pos(QMouseEventH(Event));
|
||||||
Msg.Keys := 0;
|
Msg.Keys := 0;
|
||||||
|
|
||||||
Modifiers := QInputEvent_modifiers(QInputEventH(Event));
|
Modifiers := QInputEvent_modifiers(QInputEventH(Event));
|
||||||
@ -1057,8 +1064,8 @@ begin
|
|||||||
if Modifiers and qtControlModifier<>0 then Msg.Keys := Msg.Keys or MK_CONTROL;
|
if Modifiers and qtControlModifier<>0 then Msg.Keys := Msg.Keys or MK_CONTROL;
|
||||||
{ TODO: add support for ALT, META and NUMKEYPAD }
|
{ TODO: add support for ALT, META and NUMKEYPAD }
|
||||||
|
|
||||||
Msg.XPos := SmallInt(MousePos.X);
|
Msg.XPos := SmallInt(MousePos^.X);
|
||||||
Msg.YPos := SmallInt(MousePos.Y);
|
Msg.YPos := SmallInt(MousePos^.Y);
|
||||||
|
|
||||||
MButton := QmouseEvent_Button(QMouseEventH(Event));
|
MButton := QmouseEvent_Button(QMouseEventH(Event));
|
||||||
|
|
||||||
@ -1130,16 +1137,16 @@ end;
|
|||||||
procedure TQtWidget.SlotMouseMove(Event: QEventH); cdecl;
|
procedure TQtWidget.SlotMouseMove(Event: QEventH); cdecl;
|
||||||
var
|
var
|
||||||
Msg: TLMMouseMove;
|
Msg: TLMMouseMove;
|
||||||
MousePos: TPoint;
|
MousePos: PQtPoint;
|
||||||
begin
|
begin
|
||||||
FillChar(Msg, SizeOf(Msg), #0);
|
FillChar(Msg, SizeOf(Msg), #0);
|
||||||
|
|
||||||
QMouseEvent_pos(QMouseEventH(Event), @MousePos);
|
MousePos := QMouseEvent_pos(QMouseEventH(Event));
|
||||||
|
|
||||||
//QCursor_pos(@MousePos);
|
//QCursor_pos(@MousePos);
|
||||||
|
|
||||||
Msg.XPos := SmallInt(MousePos.X);
|
Msg.XPos := SmallInt(MousePos^.X);
|
||||||
Msg.YPos := SmallInt(MousePos.Y);
|
Msg.YPos := SmallInt(MousePos^.Y);
|
||||||
|
|
||||||
Msg.Msg := LM_MOUSEMOVE;
|
Msg.Msg := LM_MOUSEMOVE;
|
||||||
|
|
||||||
@ -1159,16 +1166,16 @@ end;
|
|||||||
procedure TQtWidget.SlotMouseWheel(Event: QEventH); cdecl;
|
procedure TQtWidget.SlotMouseWheel(Event: QEventH); cdecl;
|
||||||
var
|
var
|
||||||
Msg: TLMMouseEvent;
|
Msg: TLMMouseEvent;
|
||||||
MousePos: TPoint;
|
MousePos: PQtPoint;
|
||||||
begin
|
begin
|
||||||
FillChar(Msg, SizeOf(Msg), #0);
|
FillChar(Msg, SizeOf(Msg), #0);
|
||||||
|
|
||||||
QWheelEvent_pos(QWheelEventH(Event), @MousePos);
|
MousePos := QWheelEvent_pos(QWheelEventH(Event));
|
||||||
|
|
||||||
Msg.Msg := LM_MOUSEWHEEL;
|
Msg.Msg := LM_MOUSEWHEEL;
|
||||||
|
|
||||||
Msg.X := SmallInt(MousePos.X);
|
Msg.X := SmallInt(MousePos^.X);
|
||||||
Msg.Y := SmallInt(MousePos.Y);
|
Msg.Y := SmallInt(MousePos^.Y);
|
||||||
|
|
||||||
Msg.WheelDelta := QWheelEvent_delta(QWheelEventH(Event)) div 120;
|
Msg.WheelDelta := QWheelEvent_delta(QWheelEventH(Event)) div 120;
|
||||||
|
|
||||||
@ -1994,7 +2001,7 @@ begin
|
|||||||
|
|
||||||
w := QApplication_activeWindow;
|
w := QApplication_activeWindow;
|
||||||
|
|
||||||
if not Assigned(w) and not (Application.MainForm.Visible) then
|
if not Assigned(w) and not ((Application.MainForm <> nil) and (Application.MainForm.Visible)) then
|
||||||
begin
|
begin
|
||||||
Result := QMainWindow_create(nil, QtWindow);
|
Result := QMainWindow_create(nil, QtWindow);
|
||||||
|
|
||||||
@ -2012,7 +2019,7 @@ begin
|
|||||||
window will receive and handle them
|
window will receive and handle them
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
|
|
||||||
if Assigned(Application.MainForm.Menu) then
|
if Assigned(Application.MainForm) and Assigned(Application.MainForm.Menu) then
|
||||||
QMainWindow_setMenuBar(QMainWindowH(Result), QMenuBarH(MenuBar.Widget));
|
QMainWindow_setMenuBar(QMainWindowH(Result), QMenuBarH(MenuBar.Widget));
|
||||||
|
|
||||||
{$ifdef USE_QT_4_3}
|
{$ifdef USE_QT_4_3}
|
||||||
@ -4076,14 +4083,14 @@ begin
|
|||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TQtMenu.PopUp(pos: PPoint; at: QActionH);
|
procedure TQtMenu.PopUp(pos: PQtPoint; at: QActionH);
|
||||||
begin
|
begin
|
||||||
QMenu_Popup(QMenuH(Widget), pos, at);
|
QMenu_Popup(QMenuH(Widget), pos, at);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TQtMenu.addAction(text: PWideString): TQtAction;
|
function TQtMenu.actionHandle: QActionH;
|
||||||
begin
|
begin
|
||||||
Result := TQtAction.Create(QMenu_addAction(QMenuH(Widget), text));
|
Result := QMenu_menuAction(QMenuH(Widget));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TQtMenu.addMenu(title: PWideString): TQtMenu;
|
function TQtMenu.addMenu(title: PWideString): TQtMenu;
|
||||||
@ -4091,9 +4098,31 @@ begin
|
|||||||
Result := TQtMenu.Create(QMenu_addMenu(QMenuH(Widget), title));
|
Result := TQtMenu.Create(QMenu_addMenu(QMenuH(Widget), title));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TQtMenu.addSeparator: TQtAction;
|
function TQtMenu.addSeparator: TQtMenu;
|
||||||
begin
|
begin
|
||||||
Result := TQtAction.Create(QMenu_addSeparator(QMenuH(Widget)));
|
Result := TQtMenu.Create(QMenu_addMenu(QMenuH(Widget), nil));
|
||||||
|
Result.setSeparator(True);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TQtMenu.setChecked(p1: Boolean);
|
||||||
|
begin
|
||||||
|
if p1 then setCheckable(True)
|
||||||
|
else setCheckable(False);
|
||||||
|
|
||||||
|
QAction_setChecked(ActionHandle, p1);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TQtMenu.setCheckable(p1: Boolean);
|
||||||
|
begin
|
||||||
|
QAction_setCheckable(ActionHandle, p1);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TQtMenu.setHasSubmenu(AValue: Boolean);
|
||||||
|
begin
|
||||||
|
if AValue then
|
||||||
|
QAction_setMenu(ActionHandle, QMenuH(Widget))
|
||||||
|
else
|
||||||
|
QAction_setMenu(ActionHandle, nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TQtMenu.setIcon(AIcon: QIconH);
|
procedure TQtMenu.setIcon(AIcon: QIconH);
|
||||||
@ -4117,6 +4146,22 @@ begin
|
|||||||
setIcon(FIcon);
|
setIcon(FIcon);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TQtMenu.setSeparator(AValue: Boolean);
|
||||||
|
begin
|
||||||
|
QAction_setSeparator(ActionHandle, AValue);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Method: TQtMenu.SlotTriggered
|
||||||
|
|
||||||
|
Callback for menu item click
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
procedure TQtMenu.SlotTriggered(checked: Boolean); cdecl;
|
||||||
|
begin
|
||||||
|
if Assigned(MenuItem) and Assigned(MenuItem.OnClick) then
|
||||||
|
MenuItem.OnClick(Self.MenuItem);
|
||||||
|
end;
|
||||||
|
|
||||||
{ TQtMenuBar }
|
{ TQtMenuBar }
|
||||||
|
|
||||||
constructor TQtMenuBar.Create(const AParent: QWidgetH);
|
constructor TQtMenuBar.Create(const AParent: QWidgetH);
|
||||||
@ -4129,19 +4174,15 @@ begin
|
|||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TQtMenuBar.addAction(text: PWideString): TQtAction;
|
|
||||||
begin
|
|
||||||
Result := TQtAction.Create(QMenuBar_addAction(QMenuBarH(Widget), text));
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TQtMenuBar.addMenu(title: PWideString): TQtMenu;
|
function TQtMenuBar.addMenu(title: PWideString): TQtMenu;
|
||||||
begin
|
begin
|
||||||
Result := TQtMenu.Create(QMenuBar_addMenu(QMenuBarH(Widget), title));
|
Result := TQtMenu.Create(QMenuBar_addMenu(QMenuBarH(Widget), title));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TQtMenuBar.addSeparator: TQtAction;
|
function TQtMenuBar.addSeparator: TQtMenu;
|
||||||
begin
|
begin
|
||||||
Result := TQtAction.Create(QMenuBar_addSeparator(QMenuBarH(Widget)));
|
Result := TQtMenu.Create(QMenuBar_addMenu(QMenuBarH(Widget), nil));
|
||||||
|
Result.setSeparator(True);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TQtProgressBar }
|
{ TQtProgressBar }
|
||||||
|
@ -110,12 +110,10 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
class function TQtWSMenuItem.CreateHandle(const AMenuItem: TMenuItem): HMENU;
|
class function TQtWSMenuItem.CreateHandle(const AMenuItem: TMenuItem): HMENU;
|
||||||
var
|
var
|
||||||
Action: TQtAction;
|
|
||||||
ParentMenu, Menu: TQtMenu;
|
ParentMenu, Menu: TQtMenu;
|
||||||
MenuBar: TQtMenuBar;
|
MenuBar: TQtMenuBar;
|
||||||
Text: WideString;
|
Text: WideString;
|
||||||
Method: TMethod;
|
Method: TMethod;
|
||||||
ActionHandle: Boolean = False;
|
|
||||||
begin
|
begin
|
||||||
{$ifdef VerboseQt}
|
{$ifdef VerboseQt}
|
||||||
WriteLn('trace:> [TQtWSMenuItem.CreateHandle] Caption: ', AMenuItem.Caption,
|
WriteLn('trace:> [TQtWSMenuItem.CreateHandle] Caption: ', AMenuItem.Caption,
|
||||||
@ -154,35 +152,26 @@ begin
|
|||||||
{ IsLine indicates that the menu item is a separator }
|
{ IsLine indicates that the menu item is a separator }
|
||||||
if AMenuItem.IsLine then
|
if AMenuItem.IsLine then
|
||||||
begin
|
begin
|
||||||
ActionHandle := True;
|
Menu := MenuBar.addSeparator;
|
||||||
|
|
||||||
Action := MenuBar.addSeparator;
|
|
||||||
|
|
||||||
Result := HMENU(Action);
|
|
||||||
end
|
|
||||||
{ Count indicates the number of subitems this item has }
|
|
||||||
else if AMenuItem.Count > 0 then
|
|
||||||
begin
|
|
||||||
Text := UTF8Decode(AMenuItem.Caption);
|
|
||||||
|
|
||||||
Menu := MenuBar.addMenu(@Text);
|
Menu.setHasSubmenu(False);
|
||||||
|
|
||||||
if AMenuItem.HasIcon then
|
|
||||||
Menu.setImage(TQtImage(AMenuItem.Bitmap.Handle));
|
|
||||||
|
|
||||||
Result := HMENU(Menu);
|
Result := HMENU(Menu);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
ActionHandle := True;
|
|
||||||
|
|
||||||
Text := UTF8Decode(AMenuItem.Caption);
|
Text := UTF8Decode(AMenuItem.Caption);
|
||||||
|
|
||||||
Action := MenuBar.addAction(@Text);
|
Menu := MenuBar.addMenu(@Text);
|
||||||
|
|
||||||
Action.MenuItem := AMenuItem;
|
|
||||||
|
|
||||||
Result := HMENU(Action);
|
Menu.MenuItem := AMenuItem;
|
||||||
|
|
||||||
|
if AMenuItem.HasIcon then
|
||||||
|
Menu.setImage(TQtImage(AMenuItem.Bitmap.Handle));
|
||||||
|
|
||||||
|
Menu.setHasSubmenu(AMenuItem.Count > 0);
|
||||||
|
|
||||||
|
Result := HMENU(Menu);
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -191,6 +180,8 @@ begin
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
ParentMenu := TQtMenu(AMenuItem.Parent.Handle);
|
ParentMenu := TQtMenu(AMenuItem.Parent.Handle);
|
||||||
|
|
||||||
|
ParentMenu.setHasSubmenu(True);
|
||||||
|
|
||||||
{$ifdef VerboseQt}
|
{$ifdef VerboseQt}
|
||||||
Write(' Parent: ', dbghex(PtrInt(ParentMenu)),
|
Write(' Parent: ', dbghex(PtrInt(ParentMenu)),
|
||||||
@ -200,52 +191,41 @@ begin
|
|||||||
{ IsLine indicates that the menu item is a separator }
|
{ IsLine indicates that the menu item is a separator }
|
||||||
if AMenuItem.IsLine then
|
if AMenuItem.IsLine then
|
||||||
begin
|
begin
|
||||||
ActionHandle := True;
|
Menu := ParentMenu.addSeparator;
|
||||||
|
|
||||||
Action := ParentMenu.addSeparator;
|
|
||||||
|
|
||||||
Result := HMENU(Action);
|
Menu.setHasSubmenu(False);
|
||||||
|
|
||||||
|
Result := HMENU(Menu);
|
||||||
end
|
end
|
||||||
{ Count indicates the number of subitems this item has }
|
{ Count indicates the number of subitems this item has }
|
||||||
else if AMenuItem.Count > 0 then
|
else
|
||||||
begin
|
begin
|
||||||
Text := UTF8Decode(AMenuItem.Caption);
|
Text := UTF8Decode(AMenuItem.Caption);
|
||||||
|
|
||||||
Menu := ParentMenu.addMenu(@Text);
|
Menu := ParentMenu.addMenu(@Text);
|
||||||
|
|
||||||
|
Menu.MenuItem := AMenuItem;
|
||||||
|
|
||||||
|
Menu.setEnabled(AMenuItem.Enabled);
|
||||||
|
|
||||||
|
Menu.setChecked(AMenuItem.Checked);
|
||||||
|
|
||||||
if AMenuItem.HasIcon then
|
if AMenuItem.HasIcon then
|
||||||
Menu.setImage(TQtImage(AMenuItem.Bitmap.Handle));
|
Menu.setImage(TQtImage(AMenuItem.Bitmap.Handle));
|
||||||
|
|
||||||
Result := HMENU(Menu);
|
Menu.setHasSubmenu(AMenuItem.Count > 0);
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
ActionHandle := True;
|
|
||||||
|
|
||||||
Text := UTF8Decode(AMenuItem.Caption);
|
|
||||||
|
|
||||||
Action := ParentMenu.addAction(@Text);
|
|
||||||
|
|
||||||
Action.MenuItem := AMenuItem;
|
|
||||||
|
|
||||||
Action.setEnabled(AMenuItem.Enabled);
|
|
||||||
|
|
||||||
Action.setChecked(AMenuItem.Checked);
|
|
||||||
|
|
||||||
if AMenuItem.HasIcon then
|
Result := HMENU(Menu);
|
||||||
Action.setImage(TQtImage(AMenuItem.Bitmap.Handle));
|
|
||||||
|
|
||||||
Result := HMENU(Action);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if ActionHandle then
|
if Menu <> nil then
|
||||||
begin
|
begin
|
||||||
// Trigger event
|
// Trigger event
|
||||||
|
|
||||||
QAction_triggered_Event(Method) := Action.SlotTriggered;
|
QAction_triggered_Event(Method) := Menu.SlotTriggered;
|
||||||
|
|
||||||
QAction_hook_hook_triggered(QAction_hook_create(Action.Handle), Method);
|
QAction_hook_hook_triggered(QAction_hook_create(Menu.ActionHandle), Method);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$ifdef VerboseQt}
|
{$ifdef VerboseQt}
|
||||||
@ -277,18 +257,10 @@ begin
|
|||||||
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
|
Obs: Commented because they cause access violations inside Qt
|
||||||
library on the Virtual Magnifying Glass }
|
library on the Virtual Magnifying Glass
|
||||||
if AMenuItem.Count > 0 then
|
}
|
||||||
begin
|
TQtMenu(AMenuItem.Handle).Free;
|
||||||
TQtMenu(AMenuItem.Handle).Free;
|
|
||||||
end
|
|
||||||
{ Here the menu item has a QActionH handle }
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
TQtAction(AMenuItem.Handle).Free;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -320,15 +292,7 @@ end;
|
|||||||
class procedure TQtWSMenuItem.SetVisible(const AMenuItem: TMenuItem; const Visible: boolean);
|
class procedure TQtWSMenuItem.SetVisible(const AMenuItem: TMenuItem; const Visible: boolean);
|
||||||
begin
|
begin
|
||||||
{ Here the menu item has a QMenuH handle }
|
{ Here the menu item has a QMenuH handle }
|
||||||
if AMenuItem.Count > 0 then
|
TQtMenu(AMenuItem.Handle).setVisible(Visible);
|
||||||
begin
|
|
||||||
TQtMenu(AMenuItem.Handle).setVisible(Visible);
|
|
||||||
end
|
|
||||||
{ Here the menu item has a QActionH handle }
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
TQtAction(AMenuItem.Handle).setVisible(Visible);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -338,17 +302,7 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
class function TQtWSMenuItem.SetCheck(const AMenuItem: TMenuItem; const Checked: boolean): boolean;
|
class function TQtWSMenuItem.SetCheck(const AMenuItem: TMenuItem; const Checked: boolean): boolean;
|
||||||
begin
|
begin
|
||||||
{ Here the menu item has a QMenuH handle }
|
TQtMenu(AMenuItem.Handle).setChecked(Checked);
|
||||||
if AMenuItem.Count > 0 then
|
|
||||||
begin
|
|
||||||
|
|
||||||
end
|
|
||||||
{ Here the menu item has a QActionH handle }
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
TQtAction(AMenuItem.Handle).setChecked(Checked);
|
|
||||||
end;
|
|
||||||
|
|
||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -359,17 +313,7 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
class function TQtWSMenuItem.SetEnable(const AMenuItem: TMenuItem; const Enabled: boolean): boolean;
|
class function TQtWSMenuItem.SetEnable(const AMenuItem: TMenuItem; const Enabled: boolean): boolean;
|
||||||
begin
|
begin
|
||||||
{ Here the menu item has a QMenuH handle }
|
TQtMenu(AMenuItem.Handle).setEnabled(Enabled);
|
||||||
if AMenuItem.Count > 0 then
|
|
||||||
begin
|
|
||||||
TQtMenu(AMenuItem.Handle).setEnabled(Enabled);
|
|
||||||
end
|
|
||||||
{ Here the menu item has a QActionH handle }
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
TQtAction(AMenuItem.Handle).setEnabled(Enabled);
|
|
||||||
end;
|
|
||||||
|
|
||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -399,22 +343,10 @@ class procedure TQtWSMenuItem.UpdateMenuIcon(const AMenuItem: TMenuItem;
|
|||||||
begin
|
begin
|
||||||
if AMenuItem.HasParent then
|
if AMenuItem.HasParent then
|
||||||
begin
|
begin
|
||||||
{ Here the menu item has a QMenuH handle}
|
if HasIcon then
|
||||||
if AMenuItem.Count > 0 then
|
TQtMenu(AMenuItem.Handle).setImage(TQtImage(AIcon.Handle))
|
||||||
begin
|
|
||||||
if HasIcon then
|
|
||||||
TQtMenu(AMenuItem.Handle).setImage(TQtImage(AIcon.Handle))
|
|
||||||
else
|
|
||||||
TQtMenu(AMenuItem.Handle).setImage(nil);
|
|
||||||
end
|
|
||||||
{ Here the menu item has a QActionH handle }
|
|
||||||
else
|
else
|
||||||
begin
|
TQtMenu(AMenuItem.Handle).setImage(nil);
|
||||||
if HasIcon then
|
|
||||||
TQtAction(AMenuItem.Handle).setImage(TQtImage(AIcon.Handle))
|
|
||||||
else
|
|
||||||
TQtAction(AMenuItem.Handle).setImage(nil);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -470,7 +402,7 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
class procedure TQtWSPopupMenu.Popup(const APopupMenu: TPopupMenu; const X, Y: integer);
|
class procedure TQtWSPopupMenu.Popup(const APopupMenu: TPopupMenu; const X, Y: integer);
|
||||||
var
|
var
|
||||||
Point: TPoint;
|
Point: TQtPoint;
|
||||||
begin
|
begin
|
||||||
{$ifdef VerboseQt}
|
{$ifdef VerboseQt}
|
||||||
WriteLn('[TQtWSPopupMenu.Popup] APopupMenu.Handle ' + dbghex(APopupMenu.Handle)
|
WriteLn('[TQtWSPopupMenu.Popup] APopupMenu.Handle ' + dbghex(APopupMenu.Handle)
|
||||||
|
Loading…
Reference in New Issue
Block a user