OpenCoverage

qqmlengine.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/qml/qqmlengine.h
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtQml module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#ifndef QQMLENGINE_H-
41#define QQMLENGINE_H-
42-
43#include <QtCore/qurl.h>-
44#include <QtCore/qobject.h>-
45#include <QtCore/qmap.h>-
46#include <QtQml/qjsengine.h>-
47#include <QtQml/qqml.h>-
48#include <QtQml/qqmlerror.h>-
49-
50QT_BEGIN_NAMESPACE-
51-
52class QQmlAbstractUrlInterceptor;-
53-
54class Q_QML_EXPORT QQmlImageProviderBase-
55{-
56public:-
57 enum ImageType {-
58 Image,-
59 Pixmap,-
60 Texture,-
61 Invalid,-
62 ImageResponse-
63 // ### Qt6: reorder these, and give Invalid a fixed large value-
64 };-
65-
66 enum Flag {-
67 ForceAsynchronousImageLoading = 0x01-
68 };-
69 Q_DECLARE_FLAGS(Flags, Flag)-
70-
71 virtual ~QQmlImageProviderBase();-
72-
73 virtual ImageType imageType() const = 0;-
74 virtual Flags flags() const = 0;-
75-
76private:-
77 friend class QQuickImageProvider;-
78 QQmlImageProviderBase();-
79};-
80Q_DECLARE_OPERATORS_FOR_FLAGS(QQmlImageProviderBase::Flags)-
81-
82class QQmlComponent;-
83class QQmlEnginePrivate;-
84class QQmlImportsPrivate;-
85class QQmlExpression;-
86class QQmlContext;-
87class QQmlType;-
88class QUrl;-
89#if QT_CONFIG(qml_network)-
90class QNetworkAccessManager;-
91class QQmlNetworkAccessManagerFactory;-
92#endif-
93class QQmlIncubationController;-
94class Q_QML_EXPORT QQmlEngine : public QJSEngine-
95{-
96 Q_PROPERTY(QString offlineStoragePath READ offlineStoragePath WRITE setOfflineStoragePath)-
97 Q_OBJECT-
98public:-
99 explicit QQmlEngine(QObject *p = nullptr);-
100 ~QQmlEngine() override;-
101-
102 QQmlContext *rootContext() const;-
103-
104 void clearComponentCache();-
105 void trimComponentCache();-
106-
107 QStringList importPathList() const;-
108 void setImportPathList(const QStringList &paths);-
109 void addImportPath(const QString& dir);-
110-
111 QStringList pluginPathList() const;-
112 void setPluginPathList(const QStringList &paths);-
113 void addPluginPath(const QString& dir);-
114-
115 bool addNamedBundle(const QString &name, const QString &fileName);-
116-
117 bool importPlugin(const QString &filePath, const QString &uri, QList<QQmlError> *errors);-
118-
119#if QT_CONFIG(qml_network)-
120 void setNetworkAccessManagerFactory(QQmlNetworkAccessManagerFactory *);-
121 QQmlNetworkAccessManagerFactory *networkAccessManagerFactory() const;-
122-
123 QNetworkAccessManager *networkAccessManager() const;-
124#endif-
125-
126 void setUrlInterceptor(QQmlAbstractUrlInterceptor* urlInterceptor);-
127 QQmlAbstractUrlInterceptor* urlInterceptor() const;-
128-
129 void addImageProvider(const QString &id, QQmlImageProviderBase *);-
130 QQmlImageProviderBase *imageProvider(const QString &id) const;-
131 void removeImageProvider(const QString &id);-
132-
133 void setIncubationController(QQmlIncubationController *);-
134 QQmlIncubationController *incubationController() const;-
135-
136 void setOfflineStoragePath(const QString& dir);-
137 QString offlineStoragePath() const;-
138 QString offlineStorageDatabaseFilePath(const QString &databaseName) const;-
139-
140 QUrl baseUrl() const;-
141 void setBaseUrl(const QUrl &);-
142-
143 bool outputWarningsToStandardError() const;-
144 void setOutputWarningsToStandardError(bool);-
145-
146 template<typename T>-
147 T singletonInstance(int qmlTypeId);-
148-
149public Q_SLOTS:-
150 void retranslate();-
151-
152public:-
153 static QQmlContext *contextForObject(const QObject *);-
154 static void setContextForObject(QObject *, QQmlContext *);-
155-
156 enum ObjectOwnership { CppOwnership, JavaScriptOwnership };-
157 static void setObjectOwnership(QObject *, ObjectOwnership);-
158 static ObjectOwnership objectOwnership(QObject *);-
159protected:-
160 QQmlEngine(QQmlEnginePrivate &dd, QObject *p);-
161 bool event(QEvent *) override;-
162-
163Q_SIGNALS:-
164 void quit();-
165 void exit(int retCode);-
166 void warnings(const QList<QQmlError> &warnings);-
167-
168private:-
169 Q_DISABLE_COPY(QQmlEngine)-
170 Q_DECLARE_PRIVATE(QQmlEngine)
executed 16341040 times by 146 tests: return reinterpret_cast<QQmlEnginePrivate *>(qGetPtrHelper(d_ptr));
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • ...
executed 4173 times by 96 tests: return reinterpret_cast<const QQmlEnginePrivate *>(qGetPtrHelper(d_ptr));
Executed by:
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlopenmetaobject
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltranslation
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickaccessible
  • tst_qquickage
  • tst_qquickanchors
  • tst_qquickangleddirection
  • tst_qquickanimatedimage
  • tst_qquickanimatedsprite
  • tst_qquickanimationcontroller
  • tst_qquickanimations
  • tst_qquickapplication
  • ...
4173-16341040
171};-
172-
173template<>-
174Q_QML_EXPORT QJSValue QQmlEngine::singletonInstance<QJSValue>(int qmlTypeId);-
175-
176template<typename T>-
177T QQmlEngine::singletonInstance(int qmlTypeId) {-
178 QJSValue instance = singletonInstance<QJSValue>(qmlTypeId);-
179 if (!instance.isQObject())
!instance.isQObject()Description
TRUEnever evaluated
FALSEnever evaluated
0
180 return nullptr;
never executed: return nullptr;
0
181-
182 QObject *object = instance.toQObject();-
183 return qobject_cast<T>(object);
never executed: return qobject_cast<T>(object);
0
184}-
185-
186QT_END_NAMESPACE-
187-
188#endif // QQMLENGINE_H-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0