I am trying to deploy a Qt6 application, which bundles its own icons (this way on Windows/OSX I get consistent icons). As part of my build I deploy into $BIN/share/icons the content of the breeze icons (I have a CMake function that does this for me).
In theory, I should do:
QStringList paths;
paths << QIcon::fallbackSearchPaths()
<< QDir(QCoreApplication::applicationDirPath() + "/../share/icons").absolutePath();
qDebug() << "Icons search path" << paths;
QIcon::setFallbackSearchPaths(paths);
QIcon::setThemeName("Breeze");
and then in my code:
newFilePopup->setIcon(QIcon::fromTheme("document-new"));
This is not working for me. For some reasons, icons are not loaded.
My build structure looks OK ( in ../share/icons/
I have a subdir which has an icon index, and in my code I use it properly).
$ ~/src/program/build/ ls -l bin/program share/icons/breeze/*.theme
-rwxrwxr-x 1 user user 12783136 Jul 25 18:42 bin/program
-rw-rw-r-- 1 user user 19288 Jul 5 13:52 share/icons/breeze/index.theme
I did not find documentation regarding this setup, and I don’t see how to debug it. Internally the code uses QThemeIconEngine(name))
which is internal. Tried looking at the code – qt/qtbase/src/gui/image/qiconloader.cpp – but found no obvious way to debug.