File indexing completed on 2024-05-05 16:07:09
0001 /* 0002 SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef QMLOBJECTSHAREDENGINE_H 0008 #define QMLOBJECTSHAREDENGINE_H 0009 0010 #include <kdeclarative/kdeclarative_export.h> 0011 #include <kdeclarative/qmlobject.h> 0012 #include <memory> 0013 0014 namespace KDeclarative 0015 { 0016 class QmlObjectSharedEnginePrivate; 0017 0018 /** 0019 * @class KDeclarative::QmlObjectSharedEngine qmlobjectsharedengine.h KDeclarative/QmlObjectSharedEngine 0020 * 0021 * @author Marco Martin <mart@kde.org> 0022 * 0023 * @short An object that instantiates an entire QML context, with its own declarative engine 0024 * 0025 * KDeclarative::QmlObjectSharedEngine is a version of QmlObject that ensures only one 0026 * QQmlEngine instance exists for the whole application. Objects created by different 0027 * instances of QmlObjectSharedEngine will be insulated by having different creation 0028 * contexts, accessible by QmlObject::rootContext() 0029 */ 0030 class KDECLARATIVE_EXPORT QmlObjectSharedEngine : public QmlObject 0031 { 0032 Q_OBJECT 0033 0034 public: 0035 /** 0036 * Constructs a new QmlObjectSharedEngine 0037 * 0038 * @param parent the parent of this object 0039 */ 0040 explicit QmlObjectSharedEngine(QObject *parent = nullptr); 0041 ~QmlObjectSharedEngine() override; 0042 0043 private: 0044 friend class QmlObjectSharedEnginePrivate; 0045 const std::unique_ptr<QmlObjectSharedEnginePrivate> d; 0046 }; 0047 0048 } 0049 0050 #endif // multiple inclusion guard