summaryrefslogtreecommitdiff
path: root/src/modlistbypriorityproxy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modlistbypriorityproxy.cpp')
-rw-r--r--src/modlistbypriorityproxy.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/modlistbypriorityproxy.cpp b/src/modlistbypriorityproxy.cpp
index f898b85b..dc16d8ea 100644
--- a/src/modlistbypriorityproxy.cpp
+++ b/src/modlistbypriorityproxy.cpp
@@ -23,6 +23,7 @@ void ModListByPriorityProxy::setSourceModel(QAbstractItemModel* model)
connect(sourceModel(), &QAbstractItemModel::layoutChanged, this, [this]() { buildTree(); }, Qt::UniqueConnection);
connect(sourceModel(), &QAbstractItemModel::rowsRemoved, this, [this]() { buildTree(); }, Qt::UniqueConnection);
connect(sourceModel(), &QAbstractItemModel::modelReset, this, &ModListByPriorityProxy::buildTree, Qt::UniqueConnection);
+ connect(sourceModel(), &QAbstractItemModel::dataChanged, this, &ModListByPriorityProxy::modelDataChanged, Qt::UniqueConnection);
refresh();
}
}
@@ -93,6 +94,22 @@ void ModListByPriorityProxy::expandItems(const QModelIndex& index) const
}
}
+void ModListByPriorityProxy::modelDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector<int>& roles)
+{
+ QModelIndex proxyTopLeft = mapFromSource(topLeft);
+ if (!proxyTopLeft.isValid()) {
+ return;
+ }
+
+ if (topLeft == bottomRight) {
+ emit dataChanged(proxyTopLeft, proxyTopLeft);
+ }
+ else {
+ QModelIndex proxyBottomRight = mapFromSource(bottomRight);
+ emit dataChanged(proxyTopLeft, proxyBottomRight);
+ }
+}
+
QModelIndex ModListByPriorityProxy::mapFromSource(const QModelIndex& sourceIndex) const
{
if (!sourceIndex.isValid()) {