How to set icon notification for Qt on Mac

I want to set an icon (notification number) in a Mac application using Qt,

I am also trying to do QApplication :: setWindowIcon (), but it only changes the icon on the window and dialog, not the icon on the dock. Is there a way to set the icon using Qt? Can I call cocoa methods from Qt to set an icon?

thank

+3


source to share


2 answers


If you are using Qt 5.3, you are in luck! Sign notification numbers are supported in the Qt Mac Extras package . In particular, see QtMac :: setApplicationIconBadgeNumber ()



+6


source


The dock icon is provided by any .icns

file used by your application, which is reflected in the icon in Finder, you can install it using ICON = /path/to/your/icon.icns

in your file .pro

. To set up notifications for your application, you need to go to the Objective-C ++ bridge, but there is an answer here that shows how to do this: Mac OS UserNotificationCenter in Qt .



0


source







All Articles