From 2b58a1e19aacc125ca90873754990ecad0e27635 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Sun, 4 Jul 2010 11:43:17 +0000 Subject: [PATCH] Pass dataChanged through MergedProxyModel --- src/core/mergedproxymodel.cpp | 8 ++++++++ src/core/mergedproxymodel.h | 1 + src/devices/devicemanager.cpp | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/core/mergedproxymodel.cpp b/src/core/mergedproxymodel.cpp index 2aa92c8b4..05265b6af 100644 --- a/src/core/mergedproxymodel.cpp +++ b/src/core/mergedproxymodel.cpp @@ -110,6 +110,8 @@ void MergedProxyModel::setSourceModel(QAbstractItemModel* source_model) { this, SLOT(RowsInserted(QModelIndex,int,int))); disconnect(sourceModel(), SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(RowsRemoved(QModelIndex,int,int))); + disconnect(sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex)), + this, SLOT(DataChanged(QModelIndex,QModelIndex))); } QAbstractProxyModel::setSourceModel(source_model); @@ -123,6 +125,8 @@ void MergedProxyModel::setSourceModel(QAbstractItemModel* source_model) { this, SLOT(RowsInserted(QModelIndex,int,int))); connect(sourceModel(), SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(RowsRemoved(QModelIndex,int,int))); + connect(sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex)), + this, SLOT(DataChanged(QModelIndex,QModelIndex))); } void MergedProxyModel::SourceModelReset() { @@ -410,3 +414,7 @@ QAbstractItemModel* MergedProxyModel::GetModel(const QModelIndex& source_index) } return NULL; } + +void MergedProxyModel::DataChanged(const QModelIndex& top_left, const QModelIndex& bottom_right) { + emit dataChanged(mapFromSource(top_left), mapFromSource(bottom_right)); +} diff --git a/src/core/mergedproxymodel.h b/src/core/mergedproxymodel.h index 69332f3a7..c7b6ec424 100644 --- a/src/core/mergedproxymodel.h +++ b/src/core/mergedproxymodel.h @@ -84,6 +84,7 @@ class MergedProxyModel : public QAbstractProxyModel { void RowsInserted(const QModelIndex& source_parent, int start, int end); void RowsAboutToBeRemoved(const QModelIndex& source_parent, int start, int end); void RowsRemoved(const QModelIndex& source_parent, int start, int end); + void DataChanged(const QModelIndex& top_left, const QModelIndex& bottom_right); private: QModelIndex GetActualSourceParent(const QModelIndex& source_parent, diff --git a/src/devices/devicemanager.cpp b/src/devices/devicemanager.cpp index 17efcdb83..5a15a72c5 100644 --- a/src/devices/devicemanager.cpp +++ b/src/devices/devicemanager.cpp @@ -194,7 +194,7 @@ void DeviceManager::PhysicalDeviceAdded(const QString &id) { DeviceInfo& info = devices_[i]; info.lister_ = lister; - dataChanged(index(i, 0), index(i, 0)); + emit dataChanged(index(i, 0), index(i, 0)); } }