У меня есть простой тест Qt приложение, которое пытается отправить уведомление пользователя на OS X:NSUserNotificationCenter defaultUserNotificationCenter возвращает нуль в приложении Qt
void Mac::notify(QString title, QString message) {
NSUserNotification *userNotification = [[[NSUserNotification alloc] init] autorelease];
userNotification.title = title.toNSString();
userNotification.informativeText = message.toNSString();
NSUserNotificationCenter* center = [NSUserNotificationCenter defaultUserNotificationCenter];
[center deliverNotification:userNotification];
}
Проблема является NSUserNotificationCenter * центр является нулевым. Я использую Qt 5.4.1, OS X 10.10. Основная функция выглядит следующим образом:
int main(int argc, char** argv) {
QApplication a(argc, argv);
App app;
QQmlApplicationEngine engine;
engine.rootContext()->setContextProperty("app", &app);
engine.load(QUrl("qrc:/Main.qml"));
return a.exec();
}
И я пытаюсь отправить уведомление на кнопку мыши
MouseArea {
anchors.fill: parent
onClicked: app.notify("Hello", "World")
}
Кто-нибудь есть идея, почему она не работает?
commit is dead link – totaam
спасибо, я удалил его – psyched