Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-43999

QApplication::setWindowIcon is no longer changing the dock icon on OSX

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.4.0
    • Fix Version/s: 5.5.0 Beta
    • Component/s: QPA
    • Labels:
      None
    • Platform/s:
      macOS
    • Commits:
      34ec0713bb5a2bc12782ab17ceabfead37c4b584

      Description

      This is a regression from Qt4

      QGuiApplication::setWindowIcon does not change the dock icon on mac.

      Testcase:

      #include <QApplication>
      #include <QWidget>
      #include <QImage>
      #include <QIcon>
       
      int main(int argc, char **argv) {
          QApplication app(argc, argv);
          QImage i(32,32, QImage::Format_RGB32);
          i.fill(Qt::blue);
          QApplication::setWindowIcon(QIcon(QPixmap::fromImage(i)));
          QWidget w;
          w.show();
          return app.exec();
      }
      

      According to the apple documentation https://developer.apple.com/library/mac/documentation/Carbon/Conceptual/customizing_docktile/docktasks_cocoa/docktasks_cocoa.html one need to call [NSApp setApplicationIconImage] to update the dock icon.
      Qt4 did that by qt_mac_set_app_icon calling in QApplication::setWindowIcon http://code.woboq.org/kde/qt4/src/gui/kernel/qapplication.cpp.html#2125
      The implementation of qt_mac_set_app_icon
      http://code.woboq.org/kde/qt4/src/gui/kernel/qapplication_mac.mm.html#471

      In qt5 however, git grep setApplicationIconImage returns no results, and even Q(Gui)ApplicationPrivate::notifyWindowIconChanged does not notify the platform plugin that the icon has changed.

        Attachments

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              Assignee:
              andysh Andy Shaw
              Reporter:
              ogoffart Olivier Goffart (Woboq GmbH)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes