aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/doc/snippets/qml/exposing-state/createWithInitialProperties.cpp
blob: 1e5f1859f97e1c49ff72534628655b91a55e80e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

#include <QtQml/qqml.h>
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlcomponent.h>
#include <QtGui/qguiapplication.h>

int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

//![0]
    QQmlEngine engine;

    QQmlComponent component(&engine, "MyModule", "RequiredProperties");
    QScopedPointer<QObject> o(component.createWithInitialProperties({
            {"thing", 11}
    }));
//![0]

    return app.exec();
}