Set icon to qtquick application in OS X
-
Hi guys
I'm trying to put my icon app and it doesn't work... i had read "here":http://qt-project.org/doc/qt-5/appicon.html an "this topic":https://qt-project.org/forums/viewthread/28987 , but i'm using OSX.
my main.cpp is this:
@qint32 main(qint32 argc, char *argv[])
{
QApplication app(argc, argv);
QQmlApplicationEngine engine;engine.rootContext()->setContextProperty("systemControler", new System); qmlRegisterType<System>("System", 1, 0, "System"); engine.load(QUrl(QStringLiteral("qrc:///qml/adviser/main.qml"))); QObject *topLevel = engine.rootObjects().value(0); QQuickWindow *win = qobject_cast<QQuickWindow*>(topLevel); app.setWindowIcon(QIcon("adviser.icns")); win->show(); return app.exec();
}@
and I had added this line to my .pro file as the guide sad:
@ICON = adviser.icns@
I had checked inside the adviser.app file and in my Resources folder i had the icon, but in the dock it doesn't appear and the adviser.app file hasn't the icon...
where is my error guys ??
best regards
Freddy
-
Hi,
Did you try to move you icon file to folder where you .pro file is saved? Also you must check the plist file. If you want to use custom plist file you must add this line to you pro file:
@
QMAKE_INFO_PLIST = Info.plist
@In plist file must have this lines:
@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>CFBundleIconFile</key>
<string>icon.icns</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleGetInfoString</key>
<string>Created by ...</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleExecutable</key>
<string>app_execute_file_name</string>
<key>CFBundleIdentifier</key>
<string>com.company.appname</string>
</dict>
</plist>
@