KTextAddons

textautogeneratehistorymodel.h
1/*
2 SPDX-FileCopyrightText: 2025 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "textautogeneratehistoryinfo.h"
10#include "textautogeneratetext_export.h"
11#include <QAbstractListModel>
12#include <QList>
13
14namespace TextAutogenerateText
15{
16class TEXTAUTOGENERATETEXT_EXPORT TextAutoGenerateHistoryModel : public QAbstractListModel
17{
18 Q_OBJECT
19public:
20 enum HistoryRole : uint16_t {
23 Model,
24 Engine,
25 ReferenceUuid,
26 };
27
28 explicit TextAutoGenerateHistoryModel(QObject *parent = nullptr);
29 ~TextAutoGenerateHistoryModel() override;
30
31 [[nodiscard]] int rowCount(const QModelIndex & = {}) const override;
32 [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override;
33
34 [[nodiscard]] QList<TextAutoGenerateHistoryInfo> historyInfos() const;
35 void setHistoryInfos(const QList<TextAutoGenerateHistoryInfo> &newHistoryInfos);
36
37 void clear();
38 void addInfo(const TextAutoGenerateHistoryInfo &msg);
39
40 [[nodiscard]] bool removeInfo(const QByteArray &uuid);
41
42private:
43 QList<TextAutoGenerateHistoryInfo> mHistoryInfos;
44};
45}
QAction * clear(const QObject *recvr, const char *slot, QObject *parent)
UserRole
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Apr 18 2025 12:00:52 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.