ViewSolutions 1.0.100.30ae2aa
View solutions of qml for quasarapp projects
Loading...
Searching...
No Matches
historynotificationsmodel.h
Go to the documentation of this file.
1//#
2//# Copyright (C) 2020-2025 QuasarApp.
3//# Distributed under the GPLv3 software license, see the accompanying
4//# Everyone is permitted to copy and distribute verbatim copies
5//# of this license document, but changing it is not allowed.
6//#
7
8#ifndef HISTORYNOTIFICATIONMODEL_H
9#define HISTORYNOTIFICATIONMODEL_H
10
11#include <QAbstractListModel>
12#include "notificationdata.h"
13namespace ViewSolutions {
14
38class VIEWSOLUTION_EXPORT HistoryNotificationsModel : public QAbstractListModel
39{
40 Q_OBJECT
41
45 enum Roles {
47 Icon = Qt::UserRole + 1,
49 Title,
51 Message,
53 Type
54 };
55
56public:
57 explicit HistoryNotificationsModel(QObject *parent = nullptr);
58
59 int rowCount(const QModelIndex &parent) const override;
60 QVariant data(const QModelIndex &index, int role) const override;
61 QHash<int, QByteArray> roleNames() const override;
62
67 void addHistoryObject(const ViewSolutions::NotificationData &notificationData);
68
73 void setHistory(const QList<ViewSolutions::NotificationData> &historyList);
74
78 Q_INVOKABLE void clearAllHistory();
79
85 Q_INVOKABLE void removeNotificationItemAtIndex(const int index);
86
87private:
88 QList<ViewSolutions::NotificationData> notificationsList;
89};
90}
91#endif // HISTORYNOTIFICATIONMODEL_H
void setHistory(const QList< ViewSolutions::NotificationData > &historyList)
setHistory replaces the complete history list with a new one.
Q_INVOKABLE void clearAllHistory()
clearAllHistory removes all notifications from the history.
QVariant data(const QModelIndex &index, int role) const override
Q_INVOKABLE void removeNotificationItemAtIndex(const int index)
removeNotificationItemAtIndex removes one notification from the history list.
int rowCount(const QModelIndex &parent) const override
void addHistoryObject(const ViewSolutions::NotificationData &notificationData)
addHistoryObject adds a new notification to the history list.
QHash< int, QByteArray > roleNames() const override
The NotificationData class view data for NotificationServiceView. This class contains a structure wit...
The ViewSolutions namespace.
#define VIEWSOLUTION_EXPORT
VIEWSOLUTION_EXPORT marks a symbol as part of the public ViewSolutions API.