diff options
author | wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com> | 2018-12-18 17:50:44 +0800 |
---|---|---|
committer | wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com> | 2018-12-18 17:50:44 +0800 |
commit | fe42b81570d9730042a52d02ba8715bf75686ca0 (patch) | |
tree | e4cc667af5263c5a09247fbac12794d47f841a41 /app/main.cpp | |
parent | fe3d069d19d4c11c9d905da1d4412a77295a438d (diff) |
change onscreenapp
Diffstat (limited to 'app/main.cpp')
-rw-r--r-- | app/main.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/main.cpp b/app/main.cpp index 67a6e9e..7dbd13c 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -19,10 +19,12 @@ #include <QtGui/QGuiApplication> #include <QtQml/QQmlApplicationEngine> #include <QtQml/QQmlContext> +#include <QtQml/qqml.h> #include <QQuickWindow> #include <QtQuickControls2/QQuickStyle> #include "eventhandler.h" +#include "onscreenmodel.h" int main(int argc, char *argv[]) @@ -58,6 +60,7 @@ int main(int argc, char *argv[]) EventHandler *eventHandler = new EventHandler(); eventHandler->init(port, token.toStdString().c_str()); engine.rootContext()->setContextProperty("eventHandler", eventHandler); + qmlRegisterType<OnScreenModel>("OnScreenModel", 1, 0, "OnScreenModel"); engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); if (engine.rootObjects().isEmpty()) { HMI_DEBUG(APP_ID, "Fatal Error, rootObject is empty!"); @@ -66,10 +69,11 @@ int main(int argc, char *argv[]) QObject *root = engine.rootObjects().first(); QQuickWindow *window = qobject_cast<QQuickWindow *>(root); - QObject::connect(eventHandler, SIGNAL(signalLoader(QVariant)), window, SLOT(qmlLoader(QVariant))); - QObject::connect(eventHandler, SIGNAL(signalOnScreenParameter(QVariant)), window, SLOT(qmlOnScreenParameter(QVariant))); + QObject::connect(eventHandler, SIGNAL(updateModel(QVariant)), window, SLOT(setOnScreenModel(QVariant))); + QObject::connect(eventHandler, SIGNAL(showOnScreen()), window, SLOT(showOnScreen())); + QObject::connect(eventHandler, SIGNAL(hideOnScreen()), window, SLOT(hideOnScreen())); - HMI_DEBUG(APP_ID, "Launched!"); + HMI_DEBUG(APP_ID, "onscreenapp started!"); return app.exec(); } |