mirror of
https://github.com/QuasarApp/SimpleQmlNotify.git
synced 2025-05-11 20:59:33 +00:00
There was refactored code
This commit is contained in:
parent
45edd82368
commit
95eb3eca16
@ -39,10 +39,10 @@ QHash<int, QByteArray> HistoryNotificationsModel::roleNames() const {
|
|||||||
|
|
||||||
|
|
||||||
void HistoryNotificationsModel::setHistory(const QmlNotificationService::NotificationData ¬ificationData) {
|
void HistoryNotificationsModel::setHistory(const QmlNotificationService::NotificationData ¬ificationData) {
|
||||||
beginResetModel();
|
const int index = notificationsList.count() > 0? notificationsList.count() - 1 : notificationsList.count();
|
||||||
notificationsList.push_back(notificationData);
|
beginInsertRows(QModelIndex(), index, index);
|
||||||
endResetModel();
|
notificationsList.insert(index, notificationData);
|
||||||
emit dataInserted();
|
endInsertRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryNotificationsModel::clearAllHistory() {
|
void HistoryNotificationsModel::clearAllHistory() {
|
||||||
|
@ -15,8 +15,6 @@ class HistoryNotificationsModel : public QAbstractListModel
|
|||||||
Type
|
Type
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_PROPERTY(int notificationsCount READ getNotificationsCount WRITE setNotificationsCount NOTIFY notificationsCountChanged)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit HistoryNotificationsModel(QObject *parent = nullptr);
|
explicit HistoryNotificationsModel(QObject *parent = nullptr);
|
||||||
|
|
||||||
@ -34,7 +32,6 @@ signals:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QList<QmlNotificationService::NotificationData> notificationsList;
|
QList<QmlNotificationService::NotificationData> notificationsList;
|
||||||
int m_notificationsCount;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // HISTORYNOTIFICATIONMODEL_H
|
#endif // HISTORYNOTIFICATIONMODEL_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user