1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQMLTYPELOADERNETWORKREPLYPROXY_P_H
5#define QQMLTYPELOADERNETWORKREPLYPROXY_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQml/qtqmlglobal.h>
19#include <QtCore/qobject.h>
20#include <QtCore/private/qglobal_p.h>
21
22QT_REQUIRE_CONFIG(qml_network);
23
24QT_BEGIN_NAMESPACE
25
26class QNetworkReply;
27class QQmlTypeLoader;
28
29// This is a lame object that we need to ensure that slots connected to
30// QNetworkReply get called in the correct thread (the loader thread).
31// As QQmlTypeLoader lives in the main thread, and we can't use
32// Qt::DirectConnection connections from a QNetworkReply (because then
33// sender() wont work), we need to insert this object in the middle.
34class QQmlTypeLoaderNetworkReplyProxy : public QObject
35{
36 Q_OBJECT
37public:
38 QQmlTypeLoaderNetworkReplyProxy(QQmlTypeLoader *l);
39
40public Q_SLOTS:
41 void finished();
42 void downloadProgress(qint64, qint64);
43 void manualFinished(QNetworkReply*);
44
45private:
46 QQmlTypeLoader *l;
47};
48
49QT_END_NAMESPACE
50
51#endif // QQMLTYPELOADERNETWORKREPLYPROXY_P_H
52

source code of qtdeclarative/src/qml/qml/qqmltypeloadernetworkreplyproxy_p.h