Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.7.0
-
None
-
-
245bdc8ec (dev), bf1d4023f (6.8)
Description
Using the new Windows platform icon engine that was enabled with the Qt 6.7 release, I have this code:
auto icon = QIcon::fromTheme("document-open"); auto pixmap = icon.pixmap({ 20, 20 }, 1.5); qDebug() << pixmap.devicePixelRatio(); qDebug() << pixmap.size();
Which outputs:
2.25 QSize(45, 45)
But as the code requests a device pixel ratio of 1.5, I would expect the output to be:
1.5 QSize(30, 30)
This happens because inside QWindowsIconEngine::scaledPixmap() when creating the QPixmap the size is multiplied by scale, but it has already been multiplied by scale inside QIcon::pixmap() when passing the size parameter to the engine scaledPixmap() virtual method.
After return from scaledPixmap(), QIconPrivate::pixmapDevicePixelRatio() looks at the actual size of the QPixmap returned and calculates the actual devicePixelRatio based on that, 45 ÷ 20 = 2.25, so that's what it gets set to.
I'm thinking should only be multiplying size by scale once, not twice. So therefore, suggest that one of the duplicate multiplications gets removed.
The other new platform icon engines should probably be checked also.
Attachments
Issue Links
- resulted in
-
QTBUG-126388 [REG 6.8.0 -> 6.9.0] QTableView: Icons are incorrectly scaled
- Closed