Merge branch 'qtmenus-scaled-images' into 'main'

Qt: Fixed menus backed by multi-resolution image lists always using the 96ppi...

See merge request freepascal.org/lazarus/lazarus!282
This commit is contained in:
Maxim Ganetsky 2024-04-28 15:03:19 +00:00
commit c8ff920fa6
3 changed files with 21 additions and 6 deletions

View File

@ -136,8 +136,13 @@ begin
if (ImgList <> nil) and (AMenuItem.ImageIndex >= 0) and
(AMenuItem.ImageIndex < ImgList.Count) then
begin
ImgList.ResolutionForPPI[16, ScreenInfo.PixelsPerInchX, 1].GetBitmap(AMenuItem.ImageIndex, AMenuItem.Bitmap); // Qt bindings support only 16px icons for menu items
Result.setImage(TQtImage(AMenuItem.Bitmap.Handle));
Bmp := TBitmap.Create;
try
ImgList.ResolutionForPPI[16, ScreenInfo.PixelsPerInchX, 1].GetBitmap(AMenuItem.ImageIndex, Bmp); // Qt bindings support only 16px icons for menu items
Result.setImage(TQtImage(Bmp.Handle));
finally
Bmp.Free;
end;
end else
if Assigned(AMenuItem.Bitmap) then
begin

View File

@ -135,8 +135,13 @@ begin
if (ImgList <> nil) and (AMenuItem.ImageIndex >= 0) and
(AMenuItem.ImageIndex < ImgList.Count) then
begin
ImgList.ResolutionForPPI[16, ScreenInfo.PixelsPerInchX, 1].GetBitmap(AMenuItem.ImageIndex, AMenuItem.Bitmap); // Qt bindings support only 16px icons for menu items
Result.setImage(TQtImage(AMenuItem.Bitmap.Handle));
Bmp := TBitmap.Create;
try
ImgList.ResolutionForPPI[16, ScreenInfo.PixelsPerInchX, 1].GetBitmap(AMenuItem.ImageIndex, Bmp); // Qt bindings support only 16px icons for menu items
Result.setImage(TQtImage(Bmp.Handle));
finally
Bmp.Free;
end;
end else
if Assigned(AMenuItem.Bitmap) then
begin

View File

@ -135,8 +135,13 @@ begin
if (ImgList <> nil) and (AMenuItem.ImageIndex >= 0) and
(AMenuItem.ImageIndex < ImgList.Count) then
begin
ImgList.ResolutionForPPI[16, ScreenInfo.PixelsPerInchX, 1].GetBitmap(AMenuItem.ImageIndex, AMenuItem.Bitmap); // Qt bindings support only 16px icons for menu items
Result.setImage(TQtImage(AMenuItem.Bitmap.Handle));
Bmp := TBitmap.Create;
try
ImgList.ResolutionForPPI[16, ScreenInfo.PixelsPerInchX, 1].GetBitmap(AMenuItem.ImageIndex, Bmp); // Qt bindings support only 16px icons for menu items
Result.setImage(TQtImage(Bmp.Handle));
finally
Bmp.Free;
end;
end else
if Assigned(AMenuItem.Bitmap) then
begin