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. Run-time Set OSX Dock Icon

Run-time Set OSX Dock Icon

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.0k 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.
  • D Offline
    D Offline
    Danapperloo
    wrote on last edited by Danapperloo
    #1

    I'm attempting to set the Dock Icon for my application dynamically via the call

    QWindow::setWindowIcon(QIcon);
    

    The documentation (http://doc.qt.io/qt-5/appicon.html) says:
    "The application icon, typically displayed in the application dock area, is set by calling QWindow::setWindowIcon() on a window. It is possible that the program could appear in the application dock area before the function call, in which case a default icon will appear during the bouncing animation."

    However it seems to have no effect on the Dock.

    The call does alter the Window's Icon (top left of the Window).

    Does anyone have any experience achieving this? Is the call correct? Are there timing restrictions (ie. before show())? Is my Icon invalid for this case somehow?

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

      Hi and welcome to devnet,

      macOS dock is a different beast in regard of the other OSs. You might have to do a bit of native coding for that.

      Take a look at the Apple documentation for Dock.

      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
      • D Offline
        D Offline
        Danapperloo
        wrote on last edited by
        #3

        Thanks for the link.

        I was able to achieve the desired behavior by also using the following code:

         NSImage * icon;
        [NSApp setApplicationIconImage: icon];
        [[NSApp dockTile] display];
        

        In my opinion, the Qt document is misleading / incorrect on the behavior of that API for OSX.
        Hopefully others can benefit from my troubles though.

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

          The documentation might indeed benefit from a clarification about that.

          Please open a report against qtbase for the documentation on the bug report system.

          You can even do a submission to improve the documentation yourself.

          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

          • Login

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