Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
createWithInitialProperties.cpp
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4#include <QtQml/qqml.h>
5#include <QtQml/qqmlengine.h>
6#include <QtQml/qqmlcomponent.h>
7#include <QtGui/qguiapplication.h>
8
9int main(int argc, char *argv[])
10{
11 QGuiApplication app(argc, argv);
12
15
16 QQmlComponent component(&engine, "MyModule", "RequiredProperties");
17 QScopedPointer<QObject> o(component.createWithInitialProperties({
18 {"thing", 11}
19 }));
21
22 return app.exec();
23}
static int exec()
Enters the main event loop and waits until exit() is called, then returns the value that was set to e...
\macro qGuiApp
The QQmlComponent class encapsulates a QML component definition.
The QQmlEngine class provides an environment for instantiating QML components.
Definition qqmlengine.h:57
\inmodule QtCore
int main()
[0]
static qreal component(const QPointF &point, unsigned int i)
QApplication app(argc, argv)
[0]
QJSEngine engine
[0]