mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
Currently modules are initialized as QQuickItems. In order to be able to add custom properties for modules to set in the future, introduce InitialStartModule as the top-level QML object for modules to initialize. Currently only two properties are implemented: `available` for whether to show the module in the wizard, and `contentItem` for the visual module item.
40 lines
1 KiB
C++
40 lines
1 KiB
C++
// SPDX-FileCopyrightText: 2024 Devin Lin <devin@kde.org>
|
|
// SPDX-License-Identifier: LGPL-2.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include "qqml.h"
|
|
#include <QAbstractListModel>
|
|
#include <QQmlListProperty>
|
|
#include <QQuickItem>
|
|
|
|
class InitialStartModule : public QObject
|
|
{
|
|
Q_OBJECT
|
|
QML_ELEMENT
|
|
|
|
Q_PROPERTY(bool available READ available WRITE setAvailable NOTIFY availableChanged)
|
|
Q_PROPERTY(QQuickItem *contentItem READ contentItem WRITE setContentItem REQUIRED NOTIFY contentItemChanged)
|
|
Q_PROPERTY(QQmlListProperty<QObject> children READ children CONSTANT)
|
|
Q_CLASSINFO("DefaultProperty", "children")
|
|
|
|
public:
|
|
InitialStartModule(QObject *parent = nullptr);
|
|
|
|
bool available() const;
|
|
void setAvailable(bool available);
|
|
|
|
QQuickItem *contentItem();
|
|
void setContentItem(QQuickItem *contentItem);
|
|
|
|
QQmlListProperty<QObject> children();
|
|
|
|
Q_SIGNALS:
|
|
void availableChanged();
|
|
void contentItemChanged();
|
|
|
|
private:
|
|
bool m_available{true};
|
|
QQuickItem *m_contentItem{nullptr};
|
|
QList<QObject *> m_children;
|
|
};
|