Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.1
-
None
-
Windows 10
Description
The documentation https://doc.qt.io/qt-5/qicon.html#pixmap says "The pixmap might be smaller than requested, but never larger, unless the device-pixel ratio of the returned pixmap is larger than 1."
But in my code I request size 64x64 but obtain size 256x256, which is larger than requested size (with device-pixel ratio is still 1). See the code:
#include <QApplication> #include <QLabel> #include <QFileIconProvider> #include <QIcon> #include <QPixmap> #include <QDebug> int main(int argc, char *argv[]) { QApplication a(argc, argv); QSize size = {64, 64}; QFileIconProvider iconProvider; QIcon icon = iconProvider.icon(QFileInfo("C:/Windows")); QPixmap pixmap = icon.pixmap(size); qInfo() << size << pixmap.size() << pixmap.devicePixelRatio(); // prints QSize(64, 64) QSize(256, 256) 1 QLabel w; w.setPixmap(pixmap); w.show(); return a.exec(); }