1// qqmlengine.sip generated by MetaSIP
2//
3// This file is part of the QtQml Python extension module.
4//
5// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
6//
7// This file is part of PyQt5.
8//
9// This file may be used under the terms of the GNU General Public License
10// version 3.0 as published by the Free Software Foundation and appearing in
11// the file LICENSE included in the packaging of this file.  Please review the
12// following information to ensure the GNU General Public License version 3.0
13// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
14//
15// If you do not wish to use this file under the terms of the GPL version 3.0
16// then you may purchase a commercial license.  For more information contact
17// info@riverbankcomputing.com.
18//
19// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21
22
23class QQmlImageProviderBase /Supertype=sip.wrapper/
24{
25%TypeHeaderCode
26#include <qqmlengine.h>
27%End
28
29public:
30    enum ImageType
31    {
32        Image,
33        Pixmap,
34        Texture,
35%If (Qt_5_6_0 -)
36        ImageResponse,
37%End
38    };
39
40    enum Flag
41    {
42        ForceAsynchronousImageLoading,
43    };
44
45    typedef QFlags<QQmlImageProviderBase::Flag> Flags;
46    virtual ~QQmlImageProviderBase();
47    virtual QQmlImageProviderBase::ImageType imageType() const = 0;
48    virtual QQmlImageProviderBase::Flags flags() const = 0;
49
50private:
51    QQmlImageProviderBase();
52};
53
54QFlags<QQmlImageProviderBase::Flag> operator|(QQmlImageProviderBase::Flag f1, QFlags<QQmlImageProviderBase::Flag> f2);
55
56class QQmlEngine : QJSEngine
57{
58%TypeHeaderCode
59#include <qqmlengine.h>
60%End
61
62public:
63%If (Qt_5_6_1 -)
64    explicit QQmlEngine(QObject *parent /TransferThis/ = 0);
65%End
66%If (- Qt_5_6_1)
67    QQmlEngine(QObject *parent /TransferThis/ = 0);
68%End
69    virtual ~QQmlEngine();
70    QQmlContext *rootContext() const;
71    void clearComponentCache();
72    void trimComponentCache();
73    QStringList importPathList() const;
74    void setImportPathList(const QStringList &paths);
75    void addImportPath(const QString &dir);
76    QStringList pluginPathList() const;
77    void setPluginPathList(const QStringList &paths);
78    void addPluginPath(const QString &dir);
79    bool addNamedBundle(const QString &name, const QString &fileName);
80    bool importPlugin(const QString &filePath, const QString &uri, QList<QQmlError> *errors /GetWrapper/);
81%MethodCode
82        int orig_size = (a2 ? a2->size() : 0);
83
84        sipRes = sipCpp->importPlugin(*a0, *a1, a2);
85
86        if (a2)
87        {
88            for (int i = a2->size(); i > orig_size; --i)
89            {
90                QQmlError *new_error = new QQmlError(a2->at(i - orig_size - 1));
91                PyObject *new_error_obj = sipConvertFromNewType(new_error, sipType_QQmlError, 0);
92
93                if (!new_error_obj)
94                {
95                    delete new_error;
96                    sipError = sipErrorFail;
97                    break;
98                }
99
100                if (PyList_Insert(a2Wrapper, 0, new_error_obj) < 0)
101                {
102                    Py_DECREF(new_error_obj);
103                    sipError = sipErrorFail;
104                    break;
105                }
106
107                Py_DECREF(new_error_obj);
108            }
109        }
110%End
111
112    void setNetworkAccessManagerFactory(QQmlNetworkAccessManagerFactory * /KeepReference/);
113    QQmlNetworkAccessManagerFactory *networkAccessManagerFactory() const;
114    QNetworkAccessManager *networkAccessManager() const;
115    void addImageProvider(const QString &id, QQmlImageProviderBase * /Transfer/);
116    QQmlImageProviderBase *imageProvider(const QString &id) const;
117    void removeImageProvider(const QString &id);
118    void setIncubationController(QQmlIncubationController * /KeepReference/);
119    QQmlIncubationController *incubationController() const;
120    void setOfflineStoragePath(const QString &dir);
121    QString offlineStoragePath() const;
122    QUrl baseUrl() const;
123    void setBaseUrl(const QUrl &);
124    bool outputWarningsToStandardError() const;
125    void setOutputWarningsToStandardError(bool);
126    static QQmlContext *contextForObject(const QObject *);
127    static void setContextForObject(QObject *, QQmlContext *);
128
129    enum ObjectOwnership
130    {
131        CppOwnership,
132        JavaScriptOwnership,
133    };
134
135    static void setObjectOwnership(QObject * /GetWrapper/, QQmlEngine::ObjectOwnership);
136%MethodCode
137        QQmlEngine::ObjectOwnership old = QQmlEngine::objectOwnership(a0);
138
139        QQmlEngine::setObjectOwnership(a0, a1);
140
141        if (old != a1 && !a0->parent())
142        {
143            if (old == QQmlEngine::CppOwnership)
144                sipTransferTo(a0Wrapper, Py_None);
145            else
146                sipTransferBack(a0Wrapper);
147        }
148%End
149
150    static QQmlEngine::ObjectOwnership objectOwnership(QObject *);
151
152protected:
153    virtual bool event(QEvent *);
154
155signals:
156    void quit();
157    void warnings(const QList<QQmlError> &warnings);
158%If (Qt_5_8_0 -)
159    void exit(int retCode);
160%End
161
162public:
163%If (Qt_5_9_0 -)
164    QString offlineStorageDatabaseFilePath(const QString &databaseName) const;
165%End
166
167public slots:
168%If (Qt_5_10_0 -)
169    void retranslate();
170%End
171
172public:
173%If (Qt_5_12_0 -)
174    SIP_PYOBJECT singletonInstance(int qmlTypeId) /TypeHint="QObject"/;
175%MethodCode
176        QJSValue instance = sipCpp->singletonInstance<QJSValue>(a0);
177
178        if (instance.isQObject())
179        {
180            sipRes = sipConvertFromType(instance.toQObject(), sipType_QObject, NULL);
181
182            if (!sipRes)
183                sipError = sipErrorFail;
184        }
185        else
186        {
187            sipRes = Py_None;
188            Py_INCREF(sipRes);
189        }
190%End
191
192%End
193};
194