1// Copyright (C) 2016 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 QSGCONTEXTPLUGIN_H
5#define QSGCONTEXTPLUGIN_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 <private/qtquickglobal_p.h>
19#include <QtQuick/qquickimageprovider.h>
20#include <QtCore/qplugin.h>
21#include <QtCore/qfactoryinterface.h>
22
23QT_BEGIN_NAMESPACE
24
25class QSGContext;
26
27class QSGRenderLoop;
28
29struct Q_QUICK_PRIVATE_EXPORT QSGContextFactoryInterface : public QFactoryInterface
30{
31 enum Flag {
32 SupportsShaderEffectNode = 0x01
33 };
34 Q_DECLARE_FLAGS(Flags, Flag)
35
36 virtual QSGContext *create(const QString &key) const = 0;
37 virtual Flags flags(const QString &key) const = 0;
38
39 virtual QQuickTextureFactory *createTextureFactoryFromImage(const QImage &image) = 0;
40 virtual QSGRenderLoop *createWindowManager() = 0;
41};
42
43Q_DECLARE_OPERATORS_FOR_FLAGS(QSGContextFactoryInterface::Flags)
44
45#define QSGContextFactoryInterface_iid \
46 "org.qt-project.Qt.QSGContextFactoryInterface"
47Q_DECLARE_INTERFACE(QSGContextFactoryInterface, QSGContextFactoryInterface_iid)
48
49class Q_QUICK_PRIVATE_EXPORT QSGContextPlugin : public QObject, public QSGContextFactoryInterface
50{
51 Q_OBJECT
52 Q_INTERFACES(QSGContextFactoryInterface:QFactoryInterface)
53public:
54 explicit QSGContextPlugin(QObject *parent = nullptr);
55 virtual ~QSGContextPlugin();
56
57 QStringList keys() const override = 0;
58
59 QQuickTextureFactory *createTextureFactoryFromImage(const QImage &) override { return nullptr; }
60 QSGRenderLoop *createWindowManager() override { return nullptr; }
61};
62
63QT_END_NAMESPACE
64
65#endif // QSGCONTEXTPLUGIN_H
66

source code of qtdeclarative/src/quick/scenegraph/qsgcontextplugin_p.h