diff --git a/interfaces/devicessortproxymodel.cpp b/interfaces/devicessortproxymodel.cpp index 55d616c93..1d068cb40 100644 --- a/interfaces/devicessortproxymodel.cpp +++ b/interfaces/devicessortproxymodel.cpp @@ -27,20 +27,7 @@ DevicesSortProxyModel::DevicesSortProxyModel(DevicesModel* devicesModel) : QSortFilterProxyModel(devicesModel) { setSourceModel(devicesModel); -} - -void DevicesSortProxyModel::setSourceModel(QAbstractItemModel* devicesModel) -{ - QSortFilterProxyModel::setSourceModel(devicesModel); - if (devicesModel) { - setSortRole(DevicesModel::StatusModelRole); - connect(devicesModel, &QAbstractItemModel::dataChanged, this, &DevicesSortProxyModel::sourceDataChanged); - } - sort(0); -} - -void DevicesSortProxyModel::sourceDataChanged() -{ + setSortRole(DevicesModel::StatusModelRole); sort(0); } diff --git a/interfaces/devicessortproxymodel.h b/interfaces/devicessortproxymodel.h index 435aee56d..ff7af42bc 100644 --- a/interfaces/devicessortproxymodel.h +++ b/interfaces/devicessortproxymodel.h @@ -33,10 +33,6 @@ public: explicit DevicesSortProxyModel(DevicesModel* devicesModel = nullptr); bool lessThan(const QModelIndex& left, const QModelIndex& right) const override; bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override; - void setSourceModel(QAbstractItemModel* sourceModel) override; - -public Q_SLOTS: - void sourceDataChanged(); }; #endif // DEVICESSORTPROXYMODEL_H