Merge branch 'QtThemes-GetDetailSizeForPPI' into 'main'

Qt5,Qt6: Fixed TQtThemeServices.GetDetailSizeForPPI double-scaling returned values on high DPI displays.

See merge request freepascal.org/lazarus/lazarus!286
This commit is contained in:
Maxim Ganetsky 2024-05-09 18:59:23 +00:00
commit cb6c2fdfee
2 changed files with 10 additions and 10 deletions

View File

@ -933,18 +933,18 @@ begin
Result.cy := QStyle_pixelMetric(Style, QStylePM_IndicatorHeight, nil, nil);
Result.cx := QStyle_pixelMetric(Style, QStylePM_IndicatorWidth, nil, nil);
if (Result.cx>0) then
Result.cx := MulDiv(Result.cx, PPI, 96);
Result.cx := MulDiv(Result.cx, PPI, ScreenInfo.PixelsPerInchX);
if (Result.cy>0) then
Result.cy := MulDiv(Result.cy, PPI, 96);
Result.cy := MulDiv(Result.cy, PPI, ScreenInfo.PixelsPerInchY);
end else
if Details.Part = BP_RADIOBUTTON then
begin
Result.cy := QStyle_pixelMetric(Style, QStylePM_ExclusiveIndicatorHeight, nil, nil);
Result.cx := QStyle_pixelMetric(Style, QStylePM_ExclusiveIndicatorWidth, nil, nil);
if (Result.cx>0) then
Result.cx := MulDiv(Result.cx, PPI, 96);
Result.cx := MulDiv(Result.cx, PPI, ScreenInfo.PixelsPerInchX);
if (Result.cy>0) then
Result.cy := MulDiv(Result.cy, PPI, 96);
Result.cy := MulDiv(Result.cy, PPI, ScreenInfo.PixelsPerInchY);
end else
Result := inherited;
end;
@ -968,7 +968,7 @@ begin
Result.cy := -1;
Result.cx := QStyle_pixelMetric(Style, QStylePM_MenuButtonIndicator, nil, nil);
if (Result.cx>0) then
Result.cx := MulDiv(Result.cx, PPI, 96);
Result.cx := MulDiv(Result.cx, PPI, ScreenInfo.PixelsPerInchX);
end else
Result := inherited;
else

View File

@ -937,18 +937,18 @@ begin
Result.cy := QStyle_pixelMetric(Style, QStylePM_IndicatorHeight, nil, nil);
Result.cx := QStyle_pixelMetric(Style, QStylePM_IndicatorWidth, nil, nil);
if (Result.cx>0) then
Result.cx := MulDiv(Result.cx, PPI, 96);
Result.cx := MulDiv(Result.cx, PPI, ScreenInfo.PixelsPerInchX);
if (Result.cy>0) then
Result.cy := MulDiv(Result.cy, PPI, 96);
Result.cy := MulDiv(Result.cy, PPI, ScreenInfo.PixelsPerInchY);
end else
if Details.Part = BP_RADIOBUTTON then
begin
Result.cy := QStyle_pixelMetric(Style, QStylePM_ExclusiveIndicatorHeight, nil, nil);
Result.cx := QStyle_pixelMetric(Style, QStylePM_ExclusiveIndicatorWidth, nil, nil);
if (Result.cx>0) then
Result.cx := MulDiv(Result.cx, PPI, 96);
Result.cx := MulDiv(Result.cx, PPI, ScreenInfo.PixelsPerInchX);
if (Result.cy>0) then
Result.cy := MulDiv(Result.cy, PPI, 96);
Result.cy := MulDiv(Result.cy, PPI, ScreenInfo.PixelsPerInchY);
end else
Result := inherited;
end;
@ -972,7 +972,7 @@ begin
Result.cy := -1;
Result.cx := QStyle_pixelMetric(Style, QStylePM_MenuButtonIndicator, nil, nil);
if (Result.cx>0) then
Result.cx := MulDiv(Result.cx, PPI, 96);
Result.cx := MulDiv(Result.cx, PPI, ScreenInfo.PixelsPerInchX);
end else
Result := inherited;
else