SimpleQmlNotify/qmlnotifyservice.cpp

33 lines
730 B
C++
Raw Normal View History

2020-05-23 02:30:51 +03:00
/*
2023-12-31 10:03:40 +01:00
* Copyright (C) 2018-2024 QuasarApp.
2023-03-29 12:57:55 +02:00
* Distributed under the GPLv3 software license, see the accompanying
2020-05-23 02:30:51 +03:00
* Everyone is permitted to copy and distribute verbatim copies
* of this license document, but changing it is not allowed.
*/
2019-11-19 15:20:38 +03:00
#include "notificationservice.h"
#include "qmlnotifyservice.h"
#include <QQmlApplicationEngine>
#include <QQmlContext>
namespace QmlNotificationService {
bool init(QQmlApplicationEngine *engine) {
2019-11-19 18:09:01 +03:00
if (!engine)
return false;
2019-11-19 15:20:38 +03:00
auto root = engine->rootContext();
if (!root)
return false;
2021-05-27 16:43:56 +03:00
initSNotufyResources();
2019-11-19 18:09:01 +03:00
engine->addImportPath(":/");
2019-11-19 15:20:38 +03:00
root->setContextProperty("notificationService", NotificationService::getService());
return true;
}
}