diff options
author | Holger Behrens <holger.behrens@windriver.com> | 2015-02-05 17:54:50 +0100 |
---|---|---|
committer | Holger Behrens <holger.behrens@windriver.com> | 2015-02-05 17:54:50 +0100 |
commit | 2d108be26dd2361451b7b936398dfc537764b2e3 (patch) | |
tree | d8fc21b5ef29ff72d491a6cc0879cef83c65d7c9 /app/qml-example/main.cpp | |
parent | 5ef5ed2052b5b93495de3f594838698bedcd54c1 (diff) | |
download | genivi-demo-platform-hmi-2d108be26dd2361451b7b936398dfc537764b2e3.tar.gz |
gdp-hmi-controller: introduce version 0.2, and a QML example (surface ID '3')
Signed-off-by: Holger Behrens <holger.behrens@windriver.com>
Diffstat (limited to 'app/qml-example/main.cpp')
-rw-r--r-- | app/qml-example/main.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/app/qml-example/main.cpp b/app/qml-example/main.cpp new file mode 100644 index 0000000..2cec80a --- /dev/null +++ b/app/qml-example/main.cpp @@ -0,0 +1,47 @@ +/** + * SPDX license identifier: MPL-2.0 + * + * Copyright (C) 2015 GENIVI Alliance + * + * This file is part of GENIVI AudioManager PoC. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License (MPL), v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For further information see http://www.genivi.org/. + * + * List of changes: + * 29.01.2015, Holger Behrens, written based on template created by QtCreator + * + */ + +#include <QApplication> +#include <QQuickView> +#include <systemd/sd-journal.h> + +#include "main.h" + +#define QML_EXAMPLE_SURFACE_ID 3 + +int main(int argc, char *argv[]) +{ + setenv("QT_QPA_PLATFORM", "wayland", 1); // force to use wayland plugin + setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1); + + sd_journal_print(LOG_DEBUG, "GDP: qml-example"); + + QObject *object; + QGuiApplication app(argc, argv); + QQuickView view(QUrl(QStringLiteral("qrc:/main.qml"))); + object = (QObject *)view.rootObject(); + + MyClass myClass; + QObject::connect(object, SIGNAL(qmlSignal(QString)), + &myClass, SLOT(cppSlot(QString))); + + view.setProperty("IVI-Surface-ID", QML_EXAMPLE_SURFACE_ID); + view.show(); + + return app.exec(); +} |