Qt5: added read only property MenuBar, renamed GetMenuBar to MenuBarNeeded

This commit is contained in:
Željan Rikalo 2023-02-01 16:26:09 +01:00
parent 1945f6863b
commit 317b0691ca
5 changed files with 12 additions and 10 deletions

View File

@ -1687,7 +1687,8 @@ begin
begin
MainWin := TQtMainWindow(Application.MainForm.Handle);
MainWin.Activate;
QMenuBar_setActiveAction(QMenuBarH(MainWin.GetMenuBar.Widget), Action);
if Assigned(MainWin.MenuBar) then
QMenuBar_setActiveAction(QMenuBarH(MainWin.MenuBar.Widget), Action);
end;
end;

View File

@ -668,7 +668,7 @@ type
procedure Activate; override;
function CanAdjustClientRectOnResize: Boolean; override;
function GetMenuBar: TQtMenuBar;
function MenuBarNeeded: TQtMenuBar;
function getAcceptDropFiles: Boolean; override;
function GetContainerWidget: QWidgetH; override;
procedure grabMouse; override;
@ -705,6 +705,7 @@ type
property IsFrameWindow: Boolean read FIsFrameWindow write FIsFrameWindow; {check if our LCLObject is TCustomFrame}
property FirstPaintEvent: boolean read FFirstPaintEvent write FFirstPaintEvent; {only for x11 - if firstpaintevent arrived we are 100% sure that frame is 100% accurate}
property ShowOnTaskBar: Boolean read FShowOnTaskBar;
property MenuBar: TQtMenuBar read FMenuBar;
public
function WinIDNeeded: boolean; override;
procedure AttachEvents; override;
@ -7249,7 +7250,7 @@ begin
{$ENDIF}
end;
function TQtMainWindow.GetMenuBar: TQtMenuBar;
function TQtMainWindow.MenuBarNeeded: TQtMenuBar;
var
AParent: QWidgetH;
begin

View File

@ -6143,13 +6143,13 @@ begin
if AMenuWidget is TQtMenuBar then
begin
R := AWidget.LCLObject.ClientRect;
R1 := QtMainWindow.GetMenuBar.getGeometry;
R1 := QtMainWindow.MenuBar.getGeometry;
R1.Right := R.Right;
QtMenuBar.setGeometry(R1);
QtMainWindow.setMenuBar(QMenuBarH(QtMenuBar.Widget));
end
else
QtMainWindow.setMenuBar(QMenuBarH(QtMainWindow.GetMenuBar.Widget));
end else
if Assigned(QtMainWindow.MenuBar) then
QtMainWindow.setMenuBar(QMenuBarH(QtMainWindow.MenuBar.Widget));
end;
end;

View File

@ -1033,7 +1033,7 @@ begin
if Assigned(TCustomForm(AWinControl).Menu) then
begin
AWin := TQtMainWindow(AWinControl.Handle);
AWin.GetMenuBar.sizeHint(@ASize);
AWin.MenuBar.sizeHint(@ASize);
// geometry isn't updated yet
if ASize.cy < 10 then
ASize.cy := 0;

View File

@ -442,9 +442,9 @@ begin
((AParent is TCustomForm) or (AParent is TCustomFrame)) then
begin
if (AParent is TCustomForm) then
MenuBar := TQtMainWindow(TCustomForm(AParent).Handle).GetMenuBar
MenuBar := TQtMainWindow(TCustomForm(AParent).Handle).MenuBarNeeded
else
MenuBar := TQtMainWindow(TCustomFrame(AParent).Handle).GetMenuBar;
MenuBar := TQtMainWindow(TCustomFrame(AParent).Handle).MenuBarNeeded;
Result := HMENU(MenuBar);
end else
begin