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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.5.0 Beta
    • 5.4.0
    • QPA
    • None
    • macOS
    • 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

              andysh Andy Shaw
              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