mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 04:19:20 +02:00
Qt,Qt5: fixed changing TMenuItem.ImageIndex inside main menu. issue #37608
This commit is contained in:
parent
31c207d9ed
commit
fcf361530d
@ -398,13 +398,10 @@ end;
|
|||||||
class procedure TQtWSMenuItem.UpdateMenuIcon(const AMenuItem: TMenuItem;
|
class procedure TQtWSMenuItem.UpdateMenuIcon(const AMenuItem: TMenuItem;
|
||||||
const HasIcon: Boolean; const AIcon: TBitmap);
|
const HasIcon: Boolean; const AIcon: TBitmap);
|
||||||
begin
|
begin
|
||||||
|
if not WSCheckMenuItem(AMenuItem, 'UpdateMenuIcon') then
|
||||||
|
Exit;
|
||||||
if AMenuItem.HasParent then
|
if AMenuItem.HasParent then
|
||||||
begin
|
AMenuItem.RecreateHandle;
|
||||||
if HasIcon then
|
|
||||||
TQtMenu(AMenuItem.Handle).setImage(TQtImage(AIcon.Handle))
|
|
||||||
else
|
|
||||||
TQtMenu(AMenuItem.Handle).setImage(nil);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TQtWSMenu }
|
{ TQtWSMenu }
|
||||||
|
@ -397,13 +397,10 @@ end;
|
|||||||
class procedure TQtWSMenuItem.UpdateMenuIcon(const AMenuItem: TMenuItem;
|
class procedure TQtWSMenuItem.UpdateMenuIcon(const AMenuItem: TMenuItem;
|
||||||
const HasIcon: Boolean; const AIcon: TBitmap);
|
const HasIcon: Boolean; const AIcon: TBitmap);
|
||||||
begin
|
begin
|
||||||
|
if not WSCheckMenuItem(AMenuItem, 'UpdateMenuIcon') then
|
||||||
|
Exit;
|
||||||
if AMenuItem.HasParent then
|
if AMenuItem.HasParent then
|
||||||
begin
|
AMenuItem.RecreateHandle;
|
||||||
if HasIcon then
|
|
||||||
TQtMenu(AMenuItem.Handle).setImage(TQtImage(AIcon.Handle))
|
|
||||||
else
|
|
||||||
TQtMenu(AMenuItem.Handle).setImage(nil);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TQtWSMenu }
|
{ TQtWSMenu }
|
||||||
|
Loading…
Reference in New Issue
Block a user