aboutsummaryrefslogtreecommitdiffstats
path: root/PySide/QtDeclarative/typesystem_declarative.xml
blob: 05d72e801327fde510eea41518edd24a604946ff (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?xml version="1.0"?>
<!--
    This file is part of PySide project.
    Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
    Contact: PySide team <contact@pyside.org>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-->
<typesystem package="PySide.QtDeclarative">
    <load-typesystem name="typesystem_core.xml" generate="no"/>
    <load-typesystem name="typesystem_network.xml" generate="no"/>
    <load-typesystem name="typesystem_gui.xml" generate="no"/>

    <add-function signature="qmlRegisterType(PyTypeObject, const char*, int, int, const char*)" return-type="int">
        <inject-documentation format="target" mode="append">
            This function registers the Python type in the QML system with the name qmlName, in the library imported from uri having the version number composed from versionMajor and versionMinor.
            Returns the QML type id.

            For example, this registers a Python class MySliderItem as a QML type named Slider for version 1.0 of a module called "com.mycompany.qmlcomponents":

            ::

                qmlRegisterType(MySliderItem, "com.mycompany.qmlcomponents", 1, 0, "Slider")

            Once this is registered, the type can be used in QML by importing the specified module name and version number:

            ::

                import com.mycompany.qmlcomponents 1.0

                Slider { ... }

            Note that it's perfectly reasonable for a library to register types to older versions than the actual version of the library. Indeed, it is normal for the new library to allow QML written to previous versions to continue to work, even if more advanced versions of some of its types are available.
        </inject-documentation>

        <inject-code class="target">
            %PYARG_0 = %CONVERTTOPYTHON[int](PySide::qmlRegisterType(%1, %2, %3, %4, %5));
        </inject-code>
    </add-function>

    <enum-type identified-by-value="QML_HAS_ATTACHED_PROPERTIES" since="4.7">
        <extra-includes>
            <include file-name="QtDeclarative" location="global"/>
            <!-- FIXME The include tag doesn't work on modules -->
            <include file-name="pysideqmlregistertype.h" location="local"/>
        </extra-includes>
    </enum-type>

    <inject-code class="target" position="end">
        Shiboken::TypeResolver::createValueTypeResolver&lt; QList&lt;QObject*&gt; &gt;("QList&lt;QObject*&gt;");
        PySide::initQmlSupport(module);
    </inject-code>

    <object-type name="QDeclarativeExtensionInterface"/>
    <object-type name="QDeclarativeComponent">
        <enum-type name="Status"/>
    </object-type>
    <object-type name="QDeclarativeContext">
      <modify-function signature="setContextProperty(const QString &amp;, QObject*)">
      <inject-code class="target" position="end">
        QByteArray key("%FUNCTION_NAME_");
        key.append(%1.toLocal8Bit());
        Shiboken::Object::keepReference(reinterpret_cast&lt;SbkObject*&gt;(%PYSELF), key.constData(),  %PYARG_2);
      </inject-code>
      </modify-function>
    </object-type>

    <object-type name="QDeclarativeEngine">
        <enum-type name="ObjectOwnership" />
        <modify-function signature="QDeclarativeEngine(QObject*)">
            <modify-argument index="1">
                <rename to="parent" /> <!-- Qt names this just p -->
            </modify-argument>
        </modify-function>
        <modify-function signature="setNetworkAccessManagerFactory(QDeclarativeNetworkAccessManagerFactory*)">
            <modify-argument index="1">
                <parent index="this" action="add" />
            </modify-argument>
        </modify-function>
    </object-type>
    <value-type name="QDeclarativeError" />
    <object-type name="QDeclarativeExpression" />
    <object-type name="QDeclarativeExtensionPlugin" />
    <object-type name="QDeclarativeImageProvider">
        <enum-type name="ImageType" />
    </object-type>
    <object-type name="QDeclarativeItem">
        <extra-includes>
            <include file-name="pysideqmlregistertype.h" location="local"/>
        </extra-includes>
        <enum-type name="TransformOrigin" />
        <modify-function signature="QDeclarativeItem(QDeclarativeItem*)">
            <inject-code class="target">
                if (PySide::nextQmlElementMemoryAddr)
                    %0 = new (PySide::nextQmlElementMemoryAddr) ::QDeclarativePrivate::QDeclarativeElement&lt;%TYPE>();
                else
                    %0 = new %TYPE(%1);
            </inject-code>
        </modify-function>
    </object-type>

    <value-type name="QDeclarativeListReference" />
    <object-type name="QDeclarativeNetworkAccessManagerFactory" >
        <modify-function signature="create(QObject *)">
          <modify-argument index="return">
            <define-ownership class="target" owner="c++"/>
          </modify-argument>
        </modify-function>
    </object-type>
    <object-type name="QDeclarativeParserStatus" />

    <value-type name="QDeclarativeProperty">
        <enum-type name="PropertyTypeCategory" />
        <enum-type name="Type" />
    </value-type>

    <object-type name="QDeclarativePropertyMap" />
    <object-type name="QDeclarativePropertyValueSource" />
    <value-type name="QDeclarativeScriptString" />
    <object-type name="QDeclarativeView">
        <enum-type name="ResizeMode" />
        <enum-type name="Status" />
    </object-type>
</typesystem>