Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

"Icon theme * not found." message when the icon theme is found



  • I'm setting up an application, I'm adding custom search paths for the icon theme, and setting the icon theme.
    Icons are loaded just fine but I get the message about the theme in stderr

    This is the code in my main:

    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
    
        AppInfo& info = AppInfo::instance();
        app.setApplicationName(info.slug());
        app.setApplicationDisplayName(info.name());
        app.setApplicationVersion(info.version());
        app.setOrganizationName(info.organization());
        app.setWindowIcon(QIcon(info.data_file("icon.svg")));
    
        QStringList search_paths = info.data_paths("icons");
        search_paths += QIcon::themeSearchPaths();
        QIcon::setThemeSearchPaths(search_paths);
    
        QPalette palette = QGuiApplication::palette();
        if ( palette.color(QPalette::Button).value() < 100 )
            QIcon::setThemeName("icons-dark");
        else
            QIcon::setThemeName("icons");
    
        GlaxnimateWindow window;
        window.show();
        return app.exec();
    }
    

    The message in stderr:

    Icon theme "icons" not found.
    

    It seems to be output by app.exec();.
    I'm able to use QIcon::fromTheme and get a pixmap from that icon in main before exec() and that doesn't cause the message, so I assume it isn't caused by QIcon.
    The message doesn't appear if I use one of the system icon themes in setThemeName (I'm on Kubuntu - KDE).

    Having spurious messages in stderr bothers me so I was trying to find what's causing it. If anyone has ideas it would be great.