I'm currently reading the QML docs, and I realized that there is no explanation on how to define the app icon.
I tried something, but this doesn't work:
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
app.setWindowIcon(QIcon(":/favicon.ico"));
QQmlApplicationEngine engine;
engine.load(QUrl(QLatin1String("qrc:/main.qml")));
return app.exec();
}
Can someone enlighten me? Thanks in advance:)
For me it only worked when using a PNG instead of an ICO file. Also you might want to test it with a full path:
app.setWindowIcon(QIcon("C:/path_to_ico/favicon.png"));
Or directly - if it resides in your working dir:
app.setWindowIcon(QIcon("favicon.png"));
As soon as this works you can try to use a relative path or resource access again :-)