diff --git a/apps/opencs/view/render/previewwidget.cpp b/apps/opencs/view/render/previewwidget.cpp index 94cb7ce6e..3e70fd999 100644 --- a/apps/opencs/view/render/previewwidget.cpp +++ b/apps/opencs/view/render/previewwidget.cpp @@ -149,7 +149,7 @@ void CSVRender::PreviewWidget::ReferenceDataChanged (const QModelIndex& topLeft, if (index.column()>=topLeft.column() && index.column()<=bottomRight.row()) { mReferenceableId = references.data (index).toString().toUtf8().constData(); - /// \todo update title + emit referenceableIdChanged (mReferenceableId); setModel(); } diff --git a/apps/opencs/view/render/previewwidget.hpp b/apps/opencs/view/render/previewwidget.hpp index 2b6517e71..7a63d8fb1 100644 --- a/apps/opencs/view/render/previewwidget.hpp +++ b/apps/opencs/view/render/previewwidget.hpp @@ -46,6 +46,8 @@ namespace CSVRender void closeRequest(); + void referenceableIdChanged (const std::string& id); + private slots: void ReferenceableDataChanged (const QModelIndex& topLeft, diff --git a/apps/opencs/view/world/previewsubview.cpp b/apps/opencs/view/world/previewsubview.cpp index 769ff3ddc..df9c3276c 100644 --- a/apps/opencs/view/world/previewsubview.cpp +++ b/apps/opencs/view/world/previewsubview.cpp @@ -21,10 +21,7 @@ CSVWorld::PreviewSubView::PreviewSubView (const CSMWorld::UniversalId& id, CSMDo std::string referenceableId = document.getData().getReferences().getRecord (id.getId()).get().mRefID; - if (referenceableId.empty()) - setWindowTitle ("Preview: Reference to "); - else - setWindowTitle (("Preview: Reference to " + referenceableId).c_str()); + referenceableIdChanged (referenceableId); mScene = new CSVRender::PreviewWidget (document.getData(), referenceableId, id.getId(), this); @@ -45,6 +42,8 @@ CSVWorld::PreviewSubView::PreviewSubView (const CSMWorld::UniversalId& id, CSMDo setWidget (widget); connect (mScene, SIGNAL (closeRequest()), this, SLOT (closeRequest())); + connect (mScene, SIGNAL (referenceableIdChanged (const std::string&)), + this, SLOT (referenceableIdChanged (const std::string&))); } void CSVWorld::PreviewSubView::setEditLock (bool locked) {} @@ -52,4 +51,12 @@ void CSVWorld::PreviewSubView::setEditLock (bool locked) {} void CSVWorld::PreviewSubView::closeRequest() { deleteLater(); +} + +void CSVWorld::PreviewSubView::referenceableIdChanged (const std::string& id) +{ + if (id.empty()) + setWindowTitle ("Preview: Reference to "); + else + setWindowTitle (("Preview: Reference to " + id).c_str()); } \ No newline at end of file diff --git a/apps/opencs/view/world/previewsubview.hpp b/apps/opencs/view/world/previewsubview.hpp index e7a2a261e..4ca25c3cb 100644 --- a/apps/opencs/view/world/previewsubview.hpp +++ b/apps/opencs/view/world/previewsubview.hpp @@ -30,6 +30,8 @@ namespace CSVWorld private slots: void closeRequest(); + + void referenceableIdChanged (const std::string& id); }; }