diff options
author | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2018-12-14 15:51:50 +0200 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@qt.io> | 2018-12-19 08:08:37 +0000 |
commit | 5a6b6c4bb84941df2c23901f4399bf3454fe8424 (patch) | |
tree | b122c912623d5a4a929330c5e2fbcd3bb683f390 /src/Authoring/Studio/Palettes/Inspector | |
parent | 5f86386acd008d26f37f857d6790ce08f16282ee (diff) |
Update changed presentation id also in image chooser dialog
Task-number: QT3DS-2841
Change-Id: I34bcf1d89fdae8a443745a2f2afef5120e9357bc
Reviewed-by: Janne Kangas <janne.kangas@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src/Authoring/Studio/Palettes/Inspector')
3 files changed, 15 insertions, 0 deletions
diff --git a/src/Authoring/Studio/Palettes/Inspector/ImageChooserModel.cpp b/src/Authoring/Studio/Palettes/Inspector/ImageChooserModel.cpp index e55935a0..dbb720fb 100644 --- a/src/Authoring/Studio/Palettes/Inspector/ImageChooserModel.cpp +++ b/src/Authoring/Studio/Palettes/Inspector/ImageChooserModel.cpp @@ -28,11 +28,15 @@ #include "ImageChooserModel.h" #include "StudioApp.h" +#include "ProjectFile.h" +#include "Core.h" ImageChooserModel::ImageChooserModel(bool showRenderables, QObject *parent) : ChooserModelBase(parent) , m_showRenderables(showRenderables) { + connect(&g_StudioApp.GetCore()->getProjectFile(), &ProjectFile::presentationIdChanged, + this, &ImageChooserModel::handlePresentationIdChange); } ImageChooserModel::~ImageChooserModel() @@ -57,3 +61,12 @@ QString ImageChooserModel::specialDisplayName(const ChooserModelBase::TreeItem & const QString path = item.index.data(QFileSystemModel::FilePathRole).toString(); return g_StudioApp.getRenderableId(path); } + +void ImageChooserModel::handlePresentationIdChange(const QString &path, const QString &id) +{ + Q_UNUSED(path) + Q_UNUSED(id) + + // Simply update the filename for all rows + Q_EMIT dataChanged(index(0), index(rowCount() - 1), {QFileSystemModel::FileNameRole}); +} diff --git a/src/Authoring/Studio/Palettes/Inspector/ImageChooserModel.h b/src/Authoring/Studio/Palettes/Inspector/ImageChooserModel.h index 0a87f3a1..7a1c6b5a 100644 --- a/src/Authoring/Studio/Palettes/Inspector/ImageChooserModel.h +++ b/src/Authoring/Studio/Palettes/Inspector/ImageChooserModel.h @@ -43,6 +43,7 @@ private: bool isVisible(const QString &path) const override; const QVector<FixedItem> getFixedItems() const override; QString specialDisplayName(const TreeItem &item) const override; + void handlePresentationIdChange(const QString &path, const QString &id); bool m_showRenderables = false; }; diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp index c0145ab8..79e76f3b 100644 --- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp +++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp @@ -151,6 +151,7 @@ void InspectorControlView::OnClosingPresentation() { // Image chooser model needs to be deleted, because otherwise it'll try to update the model for // the new presentation before subpresentations are resolved, corrupting the model. + // The model also has a connection to project file which needs to refreshed if project changes. delete m_imageChooserView; m_fileList.clear(); m_connections.clear(); |