Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.5, 6.8, 6.9, 6.10
-
None
Description
- Unpack icons.tar.gz
to the root
- Build the following code:
g++ -o main main.cpp $(pkg-config --cflags --libs Qt6Widgets)#include <QtWidgets> int main(int argc, char **argv) { QApplication app(argc, argv); QWidget window; const auto layout = new QHBoxLayout(&window); const auto png = new QLabel; png->setPixmap(QIcon::fromTheme("test-png").pixmap(256, 256)); layout->addWidget(png); const auto svg = new QLabel; svg->setPixmap(QIcon::fromTheme("test-svg").pixmap(256, 256)); layout->addWidget(svg); window.show(); return app.exec(); }
Expected behavior: both labels display 2
Actual behavior:
I suspect the cause is https://github.com/qt/qtbase/blob/a3b24c2842cf48bf0d82d8d52ce2dc0edd441fc4/src/gui/image/qiconloader.cpp#L516-L531, it prepends PNG icons to the front of vector which inverts the order. It perhaps should use a separate vector instead and then concatenate the two.
This is especially annoying in snap where XDG_DATA_DIRS contains folders Qt can access in the front and folders Qt can't access in the back, inverting the order leads to Qt using icon paths it can't access what leads to Qt being unable to render PNG icons at all: https://bugs.launchpad.net/snapd/+bug/2104626