aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/doc/src/bindings/qmlbindings.qdoc
blob: 89607d10dad010a94b72bd23f58a696b3272239c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** GNU Free Documentation License
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms
** and conditions contained in a signed written agreement between you
** and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
\page qml-ctypes-in-qml.html
\title C++ in QML Applications
\brief For employing C++ types and data in QML applications

To add functionality that is beyond QML and modules, C++ types are registered to
the runtime as plugins. For example, to add a full network manager into
QML, classes that utilize Qt Network classes may be registered into the runtime
and loaded as a QML type.

Additional C++ types are also available in applications through this mechanism.

\section1 C++ Types as QML Types

The QML engine can instantiate any Qt C++ construct such as properties,
functions, and data models into the QML context allowing the constructs to be
accessible from within QML.

    \list
    \li \l{C++ Types as QML Types}
    \li \l{C++ Properties, Methods, and Signals in QML}
    \endlist

\section1 Registering a Plugin
The QML engine can run Qt C++ applications by registering types into the runtime
and by loading C++ code as plugins. Plugins are imported and labeled as modules
and its content are available as types.

    To write a QML extension plugin:
    \list 1
    \li Subclass QDeclarativeExtensionPlugin
    \li Implement QDeclarativeExtensionPlugin's registerTypes() method
    \li Register types with qmlRegisterType()
    \li Export the class using the Q_EXPORT_PLUGIN2() macro
    \li Write a project file for the plugin
    \li Add the files to the project
    \endlist

    The QML Plugins page details the process using example code.
    \list
    \li \l{QML Plugins}
    \endlist
*/