Tran Quan
Tran Quan

Reputation: 1086

How to set badge notification for Qt on Mac

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

Upvotes: 3

Views: 1900

Answers (2)

MrEricSir
MrEricSir

Reputation: 8242

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()

Upvotes: 7

Nicholas Smith
Nicholas Smith

Reputation: 11754

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.

Upvotes: 0

Related Questions