Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
<
QtQuick
>
5
6
int
main
(
int
argc,
char
*argv[])
7
{
8
QCoreApplication app(argc, argv);
9
10
//![0]
11
// main.cpp
12
QQmlEngine engine;
13
QQmlComponent component(&engine,
"MyItem.qml"
);
14
QObject *object = component.create();
15
16
QString returnedValue;
17
QString msg =
"Hello from C++"
;
18
QMetaObject::invokeMethod(object,
"myQmlFunction"
,
19
Q_RETURN_ARG(QString, returnedValue),
20
Q_ARG(QString, msg));
21
22
qDebug() <<
"QML function returned:"
<< returnedValue;
23
delete
object;
24
//![0]
25
}
main
int main(int argc, char *argv[])
[ctor_close]
Definition
src_corelib_animation_qpropertyanimation.cpp:100
qtdeclarative
src
qml
doc
snippets
qml
qtbinding
functions-qml
main.cpp
Generated on
for Qt by
1.18.0