4
0
mirror of https://github.com/QuasarApp/SimpleQmlNotify.git synced 2025-05-08 11:19:38 +00:00

There was refactored code

This commit is contained in:
master 2023-04-06 16:13:59 +03:00
parent 45edd82368
commit 95eb3eca16
2 changed files with 4 additions and 7 deletions

@ -39,10 +39,10 @@ QHash<int, QByteArray> HistoryNotificationsModel::roleNames() const {
void HistoryNotificationsModel::setHistory(const QmlNotificationService::NotificationData &notificationData) {
beginResetModel();
notificationsList.push_back(notificationData);
endResetModel();
emit dataInserted();
const int index = notificationsList.count() > 0? notificationsList.count() - 1 : notificationsList.count();
beginInsertRows(QModelIndex(), index, index);
notificationsList.insert(index, notificationData);
endInsertRows();
}
void HistoryNotificationsModel::clearAllHistory() {

@ -15,8 +15,6 @@ class HistoryNotificationsModel : public QAbstractListModel
Type
};
Q_PROPERTY(int notificationsCount READ getNotificationsCount WRITE setNotificationsCount NOTIFY notificationsCountChanged)
public:
explicit HistoryNotificationsModel(QObject *parent = nullptr);
@ -34,7 +32,6 @@ signals:
private:
QList<QmlNotificationService::NotificationData> notificationsList;
int m_notificationsCount;
};
#endif // HISTORYNOTIFICATIONMODEL_H