Commit db0360a9 authored by Nicolas Fella's avatar Nicolas Fella Committed by Nicolas Fella

Simplify code in DeviceSortProxyModel

parent 2545ba59
Pipeline #3416 passed with stage
in 13 minutes and 12 seconds
......@@ -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);
}
......
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment