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:
parent
45edd82368
commit
95eb3eca16
@ -39,10 +39,10 @@ QHash<int, QByteArray> HistoryNotificationsModel::roleNames() const {
|
||||
|
||||
|
||||
void HistoryNotificationsModel::setHistory(const QmlNotificationService::NotificationData ¬ificationData) {
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user