macosqtmenudocktrayicon

How to launch a Qt application as tray icon without a window


My purpose is to create a Qt tray application without an automatically shown main window. The startup of this app, is a tray Icon with a menu.

The problem is that my dock icon is still showing up for my application.

  1. How do I prevent the dock icon from appearing?
  2. If the answer involves adding entries into the generated pfile, how do I add those to my project, such as that these entries are generated automatically into my pfile?

Solution

  • From Qt Wiki : Technical FAQ:

    How do I add a custom Info.plist to my Mac application with qmake?

    You can set your own Info.plist by setting the QMAKE_INFO_PLIST variable to your Info.plist file. qmake will add a rule in the Makefile it generates to copy this over. If you don't specify this, qmake provides a generic Info.plist file.

    QMAKE_INFO_PLIST = MyInfo.plist   # qmake will copy this file to MyApp.app/Contents/Info.plist