Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt_mac_set_dock_menu not working

    General and Desktop
    2
    4
    1234
    Loading More Posts
    • 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.
    • K
      karelhladky last edited by

      Hello everybody!

      I'm developing app for mac and I want change dock icon. I'm using this in construct of MainWindow:
      QMenu *menu = new QMenu();
      menu->setIcon(QIcon("/Users/karelhladky/battery-1.icns"));
      extern void qt_mac_set_dock_menu(QMenu *);
      qt_mac_set_dock_menu(menu);

      but nothing happens. Even if I use resource icon instead full path. By the way I download this icon http://www.iconseeker.com/search-icon/blankon/battery-1.html

      1 Reply Last reply Reply Quote 0
      • K
        karelhladky last edited by

        Well, I finally find out where was the problem - using icns files. PNG icons works perfectly :-)

        1 Reply Last reply Reply Quote 0
        • SGaist
          SGaist Lifetime Qt Champion last edited by

          Hi,

          IIRC icns files are use for the bundle icon (ICON += battery-1.icns in your pro file, and as value for CFBundleIconFile in your Info.plist)

          If you want to know what format you can use for QIcon you can use "QImageRead::supportedImageFormats":http://qt-project.org/doc/qt-4.8/qimagereader.html#supportedImageFormats

          If you really want to use icns files for icon, you will have to write your own QImageIOPluging.

          Hope you find this useful :)

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply Reply Quote 0
          • K
            karelhladky last edited by

            thanks! PNG icons are enough :)

            1 Reply Last reply Reply Quote 0
            • First post
              Last post