| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include "controlgroupprofilepart.h" |
| 7 | #include "core/qmlitem.h" |
| 8 | #include <QObject> |
| 9 | #include <string_view> |
| 10 | |
| 11 | class QQuickItem; |
| 12 | |
| 13 | class ControlGroupQMLItem |
| 14 | : public QMLItem |
| 15 | , public ControlGroupProfilePart::Importer |
| 16 | , public ControlGroupProfilePart::Exporter |
| 17 | { |
| 18 | Q_OBJECT |
| 19 | |
| 20 | public: |
| 21 | explicit ControlGroupQMLItem(std::string_view id) noexcept; |
| 22 | |
| 23 | public: |
| 24 | void activate(bool active) override; |
| 25 | |
| 26 | std::optional<std::reference_wrapper<Importable::Importer>> |
| 27 | provideImporter(Item const &i) override; |
| 28 | std::optional<std::reference_wrapper<Exportable::Exporter>> |
| 29 | provideExporter(Item const &i) override; |
| 30 | |
| 31 | bool provideActive() const override; |
| 32 | void takeActive(bool active) override; |
| 33 | |
| 34 | std::unique_ptr<Exportable::Exporter> |
| 35 | initializer(IQMLComponentFactory const &qmlComponentFactory, |
| 36 | QQmlApplicationEngine &qmlEngine) override; |
| 37 | |
| 38 | private: |
| 39 | class Initializer; |
| 40 | |
| 41 | QQuickItem *findQQuickItem(Item const &i) const; |
| 42 | |
| 43 | bool active_; |
| 44 | }; |