2023-06-29 15:06:11 +03:00
|
|
|
// Copyright (C) 2023 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2023-08-17 13:41:27 +03:00
|
|
|
#include <QMap>
|
2023-06-29 15:06:11 +03:00
|
|
|
#include <QStandardItemModel>
|
|
|
|
|
|
|
|
|
|
namespace QmlDesigner {
|
|
|
|
|
|
2023-08-17 13:41:27 +03:00
|
|
|
class CompositionNode;
|
|
|
|
|
|
2023-06-29 15:06:11 +03:00
|
|
|
class EffectMakerModel : public QAbstractListModel
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
Q_PROPERTY(bool isEmpty MEMBER m_isEmpty NOTIFY isEmptyChanged)
|
|
|
|
|
Q_PROPERTY(int selectedIndex MEMBER m_selectedIndex NOTIFY selectedIndexChanged)
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
EffectMakerModel(QObject *parent = nullptr);
|
|
|
|
|
|
|
|
|
|
QHash<int, QByteArray> roleNames() const override;
|
|
|
|
|
int rowCount(const QModelIndex & parent = QModelIndex()) const override;
|
|
|
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
|
|
|
|
|
|
|
|
bool isEmpty() const { return m_isEmpty; }
|
|
|
|
|
|
|
|
|
|
void resetModel();
|
|
|
|
|
|
2023-08-17 13:41:27 +03:00
|
|
|
void addNode(const QString &nodeQenPath);
|
2023-06-29 15:06:11 +03:00
|
|
|
|
|
|
|
|
Q_INVOKABLE void selectEffect(int idx, bool force = false);
|
|
|
|
|
Q_INVOKABLE void applyToSelected(qint64 internalId, bool add = false);
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void isEmptyChanged();
|
|
|
|
|
void selectedIndexChanged(int idx);
|
|
|
|
|
void hasModelSelectionChanged();
|
|
|
|
|
|
|
|
|
|
private:
|
2023-08-17 13:41:27 +03:00
|
|
|
enum Roles {
|
|
|
|
|
NameRole = Qt::UserRole + 1,
|
|
|
|
|
// TODO
|
|
|
|
|
};
|
|
|
|
|
|
2023-06-29 15:06:11 +03:00
|
|
|
bool isValidIndex(int idx) const;
|
|
|
|
|
|
2023-08-17 13:41:27 +03:00
|
|
|
QMap<int, CompositionNode *> m_nodes;
|
2023-06-29 15:06:11 +03:00
|
|
|
|
|
|
|
|
int m_selectedIndex = -1;
|
|
|
|
|
bool m_isEmpty = true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace QmlDesigner
|