Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3#include <QtCore>
4#include <QtQml>
5
6int main(int argc, char *argv[])
7{
8 QCoreApplication app(argc, argv);
9
12QQmlComponent component(&engine, "MyItem.qml");
13QObject *object = component.create();
14
15qDebug() << "Property value:" << QQmlProperty::read(object, "someNumber").toInt();
16QQmlProperty::write(object, "someNumber", 5000);
17
18qDebug() << "Property value:" << object->property("someNumber").toInt();
19object->setProperty("someNumber", 100);
21
22 return app.exec();
23}
24
static int exec()
Enters the main event loop and waits until exit() is called, then returns the value that was set to e...
\inmodule QtCore
\inmodule QtCore
Definition qobject.h:103
The QQmlComponent class encapsulates a QML component definition.
The QQmlEngine class provides an environment for instantiating QML components.
Definition qqmlengine.h:57
QVariant read() const
Returns the property value.
bool write(const QVariant &) const
Sets the property value to value.
int toInt(bool *ok=nullptr) const
Returns the variant as an int if the variant has userType() \l QMetaType::Int, \l QMetaType::Bool,...
int main()
[0]
#define qDebug
[1]
Definition qlogging.h:164
static qreal component(const QPointF &point, unsigned int i)
QApplication app(argc, argv)
[0]
QJSEngine engine
[0]