qqmlengine.sip 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. // qqmlengine.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtQml Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  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. class QQmlEngine : public QJSEngine
  22. {
  23. %TypeHeaderCode
  24. #include <qqmlengine.h>
  25. %End
  26. public:
  27. explicit QQmlEngine(QObject *parent /TransferThis/ = 0);
  28. virtual ~QQmlEngine();
  29. QQmlContext *rootContext() const;
  30. void clearComponentCache();
  31. void trimComponentCache();
  32. QStringList importPathList() const;
  33. void setImportPathList(const QStringList &paths);
  34. void addImportPath(const QString &dir);
  35. QStringList pluginPathList() const;
  36. void setPluginPathList(const QStringList &paths);
  37. void addPluginPath(const QString &dir);
  38. bool importPlugin(const QString &filePath, const QString &uri, QList<QQmlError> *errors /GetWrapper/);
  39. %MethodCode
  40. int orig_size = (a2 ? a2->size() : 0);
  41. sipRes = sipCpp->importPlugin(*a0, *a1, a2);
  42. if (a2)
  43. {
  44. for (int i = a2->size(); i > orig_size; --i)
  45. {
  46. QQmlError *new_error = new QQmlError(a2->at(i - orig_size - 1));
  47. PyObject *new_error_obj = sipConvertFromNewType(new_error, sipType_QQmlError, 0);
  48. if (!new_error_obj)
  49. {
  50. delete new_error;
  51. sipError = sipErrorFail;
  52. break;
  53. }
  54. if (PyList_Insert(a2Wrapper, 0, new_error_obj) < 0)
  55. {
  56. Py_DECREF(new_error_obj);
  57. sipError = sipErrorFail;
  58. break;
  59. }
  60. Py_DECREF(new_error_obj);
  61. }
  62. }
  63. %End
  64. void setNetworkAccessManagerFactory(QQmlNetworkAccessManagerFactory * /KeepReference/);
  65. QQmlNetworkAccessManagerFactory *networkAccessManagerFactory() const;
  66. QNetworkAccessManager *networkAccessManager() const;
  67. void addImageProvider(const QString &id, QQmlImageProviderBase * /Transfer/);
  68. QQmlImageProviderBase *imageProvider(const QString &id) const;
  69. void removeImageProvider(const QString &id);
  70. void setIncubationController(QQmlIncubationController * /KeepReference/);
  71. QQmlIncubationController *incubationController() const;
  72. void setOfflineStoragePath(const QString &dir);
  73. QString offlineStoragePath() const;
  74. QUrl baseUrl() const;
  75. void setBaseUrl(const QUrl &);
  76. bool outputWarningsToStandardError() const;
  77. void setOutputWarningsToStandardError(bool);
  78. static QQmlContext *contextForObject(const QObject *);
  79. static void setContextForObject(QObject *, QQmlContext *);
  80. public slots:
  81. void retranslate();
  82. protected:
  83. virtual bool event(QEvent *);
  84. signals:
  85. void quit();
  86. void warnings(const QList<QQmlError> &warnings);
  87. void exit(int retCode);
  88. public:
  89. QString offlineStorageDatabaseFilePath(const QString &databaseName) const;
  90. SIP_PYOBJECT singletonInstance(int qmlTypeId) /TypeHint="QObject"/;
  91. %MethodCode
  92. QJSValue instance = sipCpp->singletonInstance<QJSValue>(a0);
  93. if (instance.isQObject())
  94. {
  95. sipRes = sipConvertFromType(instance.toQObject(), sipType_QObject, NULL);
  96. if (!sipRes)
  97. sipError = sipErrorFail;
  98. }
  99. else
  100. {
  101. sipRes = Py_None;
  102. Py_INCREF(sipRes);
  103. }
  104. %End
  105. %If (Qt_6_5_0 -)
  106. SIP_PYOBJECT singletonInstance(QAnyStringView moduleName, QAnyStringView typeName) /TypeHint="QObject"/;
  107. %MethodCode
  108. QJSValue instance = sipCpp->singletonInstance<QJSValue>(*a0, *a1);
  109. if (instance.isQObject())
  110. {
  111. sipRes = sipConvertFromType(instance.toQObject(), sipType_QObject, NULL);
  112. if (!sipRes)
  113. sipError = sipErrorFail;
  114. }
  115. else
  116. {
  117. sipRes = Py_None;
  118. Py_INCREF(sipRes);
  119. }
  120. %End
  121. %End
  122. void addUrlInterceptor(QQmlAbstractUrlInterceptor *urlInterceptor);
  123. void removeUrlInterceptor(QQmlAbstractUrlInterceptor *urlInterceptor);
  124. QUrl interceptUrl(const QUrl &url, QQmlAbstractUrlInterceptor::DataType type) const;
  125. %If (Qt_6_2_0 -)
  126. QList<QQmlAbstractUrlInterceptor *> urlInterceptors() const;
  127. %End
  128. %If (Qt_6_3_0 -)
  129. void clearSingletons();
  130. %End
  131. signals:
  132. %If (Qt_6_5_0 -)
  133. void offlineStoragePathChanged();
  134. %End
  135. public:
  136. %If (Qt_6_6_0 -)
  137. void markCurrentFunctionAsTranslationBinding();
  138. %End
  139. };
  140. class QQmlImageProviderBase : public QObject
  141. {
  142. %TypeHeaderCode
  143. #include <qqmlengine.h>
  144. %End
  145. public:
  146. enum ImageType
  147. {
  148. Image,
  149. Pixmap,
  150. Texture,
  151. ImageResponse,
  152. };
  153. enum Flag /BaseType=Flag/
  154. {
  155. ForceAsynchronousImageLoading,
  156. };
  157. typedef QFlags<QQmlImageProviderBase::Flag> Flags;
  158. virtual ~QQmlImageProviderBase();
  159. virtual QQmlImageProviderBase::ImageType imageType() const = 0;
  160. virtual QQmlImageProviderBase::Flags flags() const = 0;
  161. private:
  162. QQmlImageProviderBase();
  163. };