Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt_mac_set_dock_menu not working

Qt_mac_set_dock_menu not working

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.4k Views
  • 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 Offline
    K Offline
    karelhladky
    wrote on last edited by
    #1

    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
    0
    • K Offline
      K Offline
      karelhladky
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        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
        0
        • K Offline
          K Offline
          karelhladky
          wrote on last edited by
          #4

          thanks! PNG icons are enough :)

          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