Qt,Qt5: fixed changing TMenuItem.ImageIndex inside main menu. issue #37608

This commit is contained in:
Željan Rikalo 2021-08-28 19:26:29 +02:00
parent 31c207d9ed
commit fcf361530d
2 changed files with 6 additions and 12 deletions

View File

@ -398,13 +398,10 @@ end;
class procedure TQtWSMenuItem.UpdateMenuIcon(const AMenuItem: TMenuItem;
const HasIcon: Boolean; const AIcon: TBitmap);
begin
if not WSCheckMenuItem(AMenuItem, 'UpdateMenuIcon') then
Exit;
if AMenuItem.HasParent then
begin
if HasIcon then
TQtMenu(AMenuItem.Handle).setImage(TQtImage(AIcon.Handle))
else
TQtMenu(AMenuItem.Handle).setImage(nil);
end;
AMenuItem.RecreateHandle;
end;
{ TQtWSMenu }

View File

@ -397,13 +397,10 @@ end;
class procedure TQtWSMenuItem.UpdateMenuIcon(const AMenuItem: TMenuItem;
const HasIcon: Boolean; const AIcon: TBitmap);
begin
if not WSCheckMenuItem(AMenuItem, 'UpdateMenuIcon') then
Exit;
if AMenuItem.HasParent then
begin
if HasIcon then
TQtMenu(AMenuItem.Handle).setImage(TQtImage(AIcon.Handle))
else
TQtMenu(AMenuItem.Handle).setImage(nil);
end;
AMenuItem.RecreateHandle;
end;
{ TQtWSMenu }