Pass on NSNotification to QMacNotificationObserver callbacks if supported
Change-Id: I167f2e24453a2f2c75b81207f7293c72243f5a7a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit c7c830057589a91cc369375775d018c5057ba46a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
5fc66f68da
commit
3cdc9084ba
@ -336,7 +336,10 @@ public:
|
||||
template<typename Functor>
|
||||
QMacNotificationObserver(NSObject *object, NSNotificationName name, Functor callback) {
|
||||
observer = [[NSNotificationCenter defaultCenter] addObserverForName:name
|
||||
object:object queue:nil usingBlock:^(NSNotification *) {
|
||||
object:object queue:nil usingBlock:^(NSNotification *notification) {
|
||||
if constexpr (std::is_invocable_v<Functor, NSNotification *>)
|
||||
callback(notification);
|
||||
else
|
||||
callback();
|
||||
}
|
||||
];
|
||||
|
Loading…
x
Reference in New Issue
Block a user