AusweisApp2
NotificationModel.h
gehe zur Dokumentation dieser Datei
1/*
2 * \copyright Copyright (c) 2019-2022 Governikus GmbH & Co. KG, Germany
3 */
4
5#pragma once
6
7#include "Env.h"
8
9#include <QAbstractListModel>
10#include <QContiguousCache>
11#include <QHash>
12#include <QObject>
13#include <QString>
14#include <QVariant>
15
16class test_NotificationModel;
17
18namespace governikus
19{
20
22 : public QAbstractListModel
23{
24 Q_OBJECT
25 friend class Env;
26 friend class ::test_NotificationModel;
27
28 Q_PROPERTY(QString lastType READ getLastType NOTIFY fireLastTypeChanged)
29
30 private:
31 enum UserRoles
32 {
33 TYPE = Qt::UserRole + 1,
34 TIME,
35 TEXT
36 };
37
38 struct NotificationEntry
39 {
40 QString mType;
41 QString mTime;
42 QString mText;
43 };
44
45 QContiguousCache<NotificationEntry> mNotificationEntries;
46
47 NotificationModel();
48 ~NotificationModel() override = default;
49 QString getLastType() const;
50
51 private Q_SLOTS:
52 void onNewLogMsg(const QString& pMsg, const QString& pCategoryName);
53
54 public:
55 int rowCount(const QModelIndex& pIndex) const override;
56 QVariant data(const QModelIndex& pIndex, int pRole) const override;
57 QHash<int, QByteArray> roleNames() const override;
58
59 Q_SIGNALS:
61};
62
63} // namespace governikus
#define TYPE(x)
Definition: Env.h:44
Definition: NotificationModel.h:23
QHash< int, QByteArray > roleNames() const override
Definition: NotificationModel.cpp:81
QVariant data(const QModelIndex &pIndex, int pRole) const override
Definition: NotificationModel.cpp:60
QString lastType
Definition: NotificationModel.h:28
int rowCount(const QModelIndex &pIndex) const override
Definition: NotificationModel.cpp:53
A simple template renderer.
Definition: ActivationContext.h:15