3

I want to set badge (notification number) on mac application using Qt,

I also try QApplication::setWindowIcon() but it's only change the icon on window and dialog, not the icon on dock. Is there anyway to set badge using Qt ? Can I call cocoa methods from Qt to set badge ?

Thank you

Marek H
  • 5,173
  • 3
  • 31
  • 42
Tran Quan
  • 1,056
  • 15
  • 28

2 Answers2

7

If you're using Qt 5.3, you're in luck! Badge notification numbers are supported in the Qt Mac Extras package. Specifically, see QtMac::setApplicationIconBadgeNumber()

MrEricSir
  • 8,044
  • 4
  • 30
  • 35
0

The dock icon is provided by whatever .icns file your app uses, which is reflected by the icon in Finder, you can set it with ICON = /path/to/your/icon.icns in your .pro file. For setting notifications for your app you have to jump into the Objective-C++ bridge, but there's an answer here that shows how to do it: Mac OS UserNotificationCenter in Qt.

Community
  • 1
  • 1
Nicholas Smith
  • 11,642
  • 6
  • 37
  • 55