8#include <QtQml/qjsengine.h>
9#if QT_CONFIG(qml_network)
10#include <QtNetwork/qnetworkrequest.h>
11#include <QtNetwork/qnetworkreply.h>
13#include <QtCore/qfile.h>
14#include <QtQml/qqmlfile.h>
16#include <private/qqmlengine_p.h>
17#include <private/qv4engine_p.h>
18#include <private/qv4functionobject_p.h>
19#include <private/qv4script_p.h>
20#include <private/qv4context_p.h>
35 m_callbackFunction.set(v4, callback);
37 m_resultObject.set(v4, resultValue(v4));
39#if QT_CONFIG(qml_network)
41 m_network =
qmlEngine->networkAccessManager();
46 m_reply = m_network->get(
request);
56QV4Include::~QV4Include()
58#if QT_CONFIG(qml_network)
81 return o.asReturnedValue();
96 jsCallData.args[0] = status;
98 if (scope.hasException())
99 scope.engine->catchException();
104 return m_resultObject.
value();
107void QV4Include::finished()
109#if QT_CONFIG(qml_network)
122 if (!scope.hasException())
124 if (scope.hasException()) {
128 resultObj->put(exception, ex);
143 callback(
cb, resultObj);
161 "Qt.include(): Can only be called from JavaScript files")));
167 if (
auto function = QJSValuePrivate::asManagedType<QV4::FunctionObject>(&callbackFunction))
180#if QT_CONFIG(qml_network)
185 callback(scopedCallbackFunction,
result);
208 callback(scopedCallbackFunction,
result);
216#include "moc_qv4include_p.cpp"
void throwError(const QString &message)
Throws a run-time error (exception) with the given message.
static QJSValue fromReturnedValue(QV4::ReturnedValue d)
The QJSValue class acts as a container for Qt/JavaScript data types.
The QNetworkRequest class holds a request to be sent with QNetworkAccessManager.
void setUrl(const QUrl &url)
Sets the URL this network request is referring to be url.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
void deleteLater()
\threadsafe
The QQmlEngine class provides an environment for instantiating QML components.
QQmlEngine * qmlEngine(const QObject *object)
Returns the QQmlEngine associated with object, if any.
QUrl interceptUrl(const QUrl &url, QQmlAbstractUrlInterceptor::DataType type) const
Run the current URL interceptors on the given url of the given type and return the result.
static QString urlToLocalFileOrQrc(const QString &)
If url is a local file returns a path suitable for passing to QFile.
bool isNull() const noexcept
Returns true if this object refers to \nullptr.
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
Deletes the existing object it is pointing to (if any), and sets its pointer to other.
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QString toString(FormattingOptions options=FormattingOptions(PrettyDecoded)) const
Returns a string representation of the URL.
static QJSValue method_include(QV4::ExecutionEngine *engine, const QUrl &url, const QJSValue &callbackFunction)
ReturnedValue value() const
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction function
DBusConnection const char DBusError * error
GLsizei const GLfloat * v
[13]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
QQmlEngine * qmlEngine(const QObject *obj)
QQmlContext * qmlContext(const QObject *obj)
SSL_CTX int(* cb)(SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)
#define QStringLiteral(str)
#define QT_CONFIG(feature)
if(qFloatDistance(a, b)<(1<< 7))
[0]
QUrl url("example.com")
[constructor-url-reference]
myObject disconnect()
[26]
QNetworkRequest request(url)
Heap::String * newString(const QString &s=QString())
Heap::Object * newObject()
static Heap::ExecutionContext * qmlContext(Heap::ExecutionContext *ctx)
ReturnedValue catchException(StackTrace *trace=nullptr)
bool hasException() const
static Script * createFromFileOrCache(ExecutionEngine *engine, QmlContext *qmlContext, const QString &fileName, const QUrl &originalUrl, QString *error)
constexpr ReturnedValue asReturnedValue() const
static constexpr Value fromInt32(int i)
static constexpr Value undefinedValue()