diff options
Diffstat (limited to 'src/qml/doc/snippets/qml/exposing-state/createWithInitialProperties.cpp')
-rw-r--r-- | src/qml/doc/snippets/qml/exposing-state/createWithInitialProperties.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/qml/doc/snippets/qml/exposing-state/createWithInitialProperties.cpp b/src/qml/doc/snippets/qml/exposing-state/createWithInitialProperties.cpp new file mode 100644 index 0000000000..1e5f1859f9 --- /dev/null +++ b/src/qml/doc/snippets/qml/exposing-state/createWithInitialProperties.cpp @@ -0,0 +1,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(); +} |