File: main.cpp

package info (click to toggle)
qt6-remoteobjects 6.9.1-6
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 3,896 kB
  • sloc: cpp: 20,881; sh: 29; makefile: 23
file content (26 lines) | stat: -rw-r--r-- 993 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright (C) 2017 Ford Motor Company
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QRemoteObjectNode>
#include <QAbstractItemModelReplica>

int main(int argc, char *argv[])
{
    QLoggingCategory::setFilterRules("qt.remoteobjects.debug=false\n"
                                     "qt.remoteobjects.warning=false\n"
                                     "qt.remoteobjects.models.debug=false\n"
                                     "qt.remoteobjects.models.debug=false");

    QGuiApplication app(argc, argv);

    QRemoteObjectNode node(QUrl(QStringLiteral("local:registry")));
    QQmlApplicationEngine engine;
    QScopedPointer<QAbstractItemModelReplica> model(node.acquireModel(QStringLiteral("RemoteModel")));
    engine.rootContext()->setContextProperty("remoteModel", model.data());
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));

    return app.exec();
}