/* SPDX-FileCopyrightText: 2024 Fushan Wen SPDX-License-Identifier: GPL-2.0-or-later */ #pragma once #include #include class HistoryModel; /** * This class provides a view for history clip items in QML **/ class DeclarativeHistoryModel : public QIdentityProxyModel { Q_OBJECT QML_NAMED_ELEMENT(HistoryModel) Q_PROPERTY(int count READ rowCount NOTIFY countChanged) Q_PROPERTY(QString currentText READ currentText NOTIFY currentTextChanged) public: explicit DeclarativeHistoryModel(QObject *parent = nullptr); ~DeclarativeHistoryModel() override; QString currentText() const; Q_INVOKABLE void moveToTop(const QByteArray &uuid); Q_INVOKABLE void remove(const QByteArray &uuid); Q_INVOKABLE void clearHistory(); Q_INVOKABLE void invokeAction(const QByteArray &uuid); Q_SIGNALS: void countChanged(); void currentTextChanged(); private: std::shared_ptr m_model; };