Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Set icon to qtquick application in OS X
Forum Updated to NodeBB v4.3 + New Features

Set icon to qtquick application in OS X

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 938 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • freddy311082F Offline
    freddy311082F Offline
    freddy311082
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • shavS Offline
      shavS Offline
      shav
      wrote on last edited by
      #2

      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>
      @

      Mac OS and iOS Developer

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved