Qt Forum

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

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Run-time Set OSX Dock Icon

    General and Desktop
    2
    4
    704
    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.
    • D
      Danapperloo last edited by Danapperloo

      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 Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        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 Reply Quote 0
        • D
          Danapperloo last edited by

          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 Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            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 Reply Quote 0
            • First post
              Last post