1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-20 03:53:52 +00:00

update preview title on changed referenceableID (preview for references only)

This commit is contained in:
Marc Zinnschlag 2014-03-21 12:52:46 +01:00
parent 58daf52a67
commit 698fe8cce3
4 changed files with 16 additions and 5 deletions

View file

@ -149,7 +149,7 @@ void CSVRender::PreviewWidget::ReferenceDataChanged (const QModelIndex& topLeft,
if (index.column()>=topLeft.column() && index.column()<=bottomRight.row()) if (index.column()>=topLeft.column() && index.column()<=bottomRight.row())
{ {
mReferenceableId = references.data (index).toString().toUtf8().constData(); mReferenceableId = references.data (index).toString().toUtf8().constData();
/// \todo update title emit referenceableIdChanged (mReferenceableId);
setModel(); setModel();
} }

View file

@ -46,6 +46,8 @@ namespace CSVRender
void closeRequest(); void closeRequest();
void referenceableIdChanged (const std::string& id);
private slots: private slots:
void ReferenceableDataChanged (const QModelIndex& topLeft, void ReferenceableDataChanged (const QModelIndex& topLeft,

View file

@ -21,10 +21,7 @@ CSVWorld::PreviewSubView::PreviewSubView (const CSMWorld::UniversalId& id, CSMDo
std::string referenceableId = std::string referenceableId =
document.getData().getReferences().getRecord (id.getId()).get().mRefID; document.getData().getReferences().getRecord (id.getId()).get().mRefID;
if (referenceableId.empty()) referenceableIdChanged (referenceableId);
setWindowTitle ("Preview: Reference to <nothing>");
else
setWindowTitle (("Preview: Reference to " + referenceableId).c_str());
mScene = mScene =
new CSVRender::PreviewWidget (document.getData(), referenceableId, id.getId(), this); new CSVRender::PreviewWidget (document.getData(), referenceableId, id.getId(), this);
@ -45,6 +42,8 @@ CSVWorld::PreviewSubView::PreviewSubView (const CSMWorld::UniversalId& id, CSMDo
setWidget (widget); setWidget (widget);
connect (mScene, SIGNAL (closeRequest()), this, SLOT (closeRequest())); 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) {} void CSVWorld::PreviewSubView::setEditLock (bool locked) {}
@ -53,3 +52,11 @@ void CSVWorld::PreviewSubView::closeRequest()
{ {
deleteLater(); deleteLater();
} }
void CSVWorld::PreviewSubView::referenceableIdChanged (const std::string& id)
{
if (id.empty())
setWindowTitle ("Preview: Reference to <nothing>");
else
setWindowTitle (("Preview: Reference to " + id).c_str());
}

View file

@ -30,6 +30,8 @@ namespace CSVWorld
private slots: private slots:
void closeRequest(); void closeRequest();
void referenceableIdChanged (const std::string& id);
}; };
} }