diff --git a/MainWindow.cpp b/MainWindow.cpp index 99b53fdad..6dafe91f2 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -445,6 +445,8 @@ void MainWindow::openProject(std::unique_ptr openedProject) { connect(treeModel.get(), &TreeModel::TreeChanged, resourceMap.get(), &ResourceModelMap::TreeChanged); connect(treeModel.get(), &TreeModel::ItemRemoved, resourceMap.get(), &ResourceModelMap::ResourceRemoved, Qt::DirectConnection); + connect(pm, &ProtoModel::dataChanged, resourceMap.get(), &ResourceModelMap::dataChanged, + Qt::DirectConnection); connect(treeModel.get(), &TreeModel::ModelAboutToBeDeleted, this, &MainWindow::ResourceModelDeleted, Qt::DirectConnection); } diff --git a/Models/ResourceModelMap.cpp b/Models/ResourceModelMap.cpp index 2b57638cd..8f5a857ae 100644 --- a/Models/ResourceModelMap.cpp +++ b/Models/ResourceModelMap.cpp @@ -43,6 +43,10 @@ static void TreeChangedHelper(MessageModel* model, ResourceModelMap* rm) { } } +void ResourceModelMap::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector &roles) { + emit DataChanged(); +} + void ResourceModelMap::TreeChanged(MessageModel* model) { _resources.clear(); TreeChangedHelper(model, this); @@ -195,8 +199,6 @@ void ResourceModelMap::ResourceRenamed(TypeCase type, const QString& oldName, co if (oldName == newName || !_resources[type].contains(oldName)) return; _resources[type][newName] = _resources[type][oldName]; - //MainWindow:: - emit ResourceRenamed(ResTypeAsString(type), oldName, newName); _resources[type].remove(oldName); diff --git a/Models/ResourceModelMap.h b/Models/ResourceModelMap.h index 590cf107c..700914806 100644 --- a/Models/ResourceModelMap.h +++ b/Models/ResourceModelMap.h @@ -21,6 +21,7 @@ class ResourceModelMap : public QObject { bool ValidName(TypeCase type, const QString& name); public slots: + void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector &roles = QVector()); void TreeChanged(MessageModel* model); void ResourceRenamed(TypeCase type, const QString& oldName, const QString& newName); void ResourceRemoved(TypeCase type, const QString& name,