diff --git a/apps/opencs/view/doc/subview.cpp b/apps/opencs/view/doc/subview.cpp index e78f8bef4..a9dce25be 100644 --- a/apps/opencs/view/doc/subview.cpp +++ b/apps/opencs/view/doc/subview.cpp @@ -3,7 +3,7 @@ #include "view.hpp" CSVDoc::SubView::SubView (const CSMWorld::UniversalId& id) - : mUniversalId (id), mParent (NULL) + : mUniversalId (id) { /// \todo add a button to the title bar that clones this sub view @@ -31,9 +31,7 @@ void CSVDoc::SubView::setUniversalId (const CSMWorld::UniversalId& id) void CSVDoc::SubView::closeEvent (QCloseEvent *event) { - // update title bars of view and subviews - if(mParent) - mParent->updateSubViewIndicies(this); + emit updateSubViewIndicies (this); } std::string CSVDoc::SubView::getTitle() const diff --git a/apps/opencs/view/doc/subview.hpp b/apps/opencs/view/doc/subview.hpp index e1331750a..a8aa3cda1 100644 --- a/apps/opencs/view/doc/subview.hpp +++ b/apps/opencs/view/doc/subview.hpp @@ -25,12 +25,13 @@ namespace CSVDoc Q_OBJECT CSMWorld::UniversalId mUniversalId; - View *mParent; // not implemented SubView (const SubView&); SubView& operator= (SubView&); + protected: + void setUniversalId(const CSMWorld::UniversalId& id); public: @@ -47,8 +48,6 @@ namespace CSVDoc virtual void useHint (const std::string& hint); ///< Default implementation: ignored - void setParent(View *parent) { mParent = parent; } - virtual std::string getTitle() const; virtual void updateUserSetting (const QString& name, const QStringList& value); @@ -65,6 +64,8 @@ namespace CSVDoc void updateTitle(); + void updateSubViewIndicies (SubView *view = 0); + protected slots: void closeRequest(); diff --git a/apps/opencs/view/doc/view.cpp b/apps/opencs/view/doc/view.cpp index d065631cb..23bd0a941 100644 --- a/apps/opencs/view/doc/view.cpp +++ b/apps/opencs/view/doc/view.cpp @@ -524,6 +524,9 @@ void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id, const std::strin connect (view, SIGNAL (updateTitle()), this, SLOT (updateTitle())); + connect (view, SIGNAL (updateSubViewIndicies (SubView *)), + this, SLOT (updateSubViewIndicies (SubView *))); + view->show(); } diff --git a/apps/opencs/view/doc/view.hpp b/apps/opencs/view/doc/view.hpp index ee062f725..55ea5ee51 100644 --- a/apps/opencs/view/doc/view.hpp +++ b/apps/opencs/view/doc/view.hpp @@ -112,9 +112,6 @@ namespace CSVDoc /// Function called by view manager when user preferences are updated void updateEditorSetting (const QString &, const QString &); - // called when subviews are added or removed - void updateSubViewIndicies(SubView *view = 0); - signals: void newGameRequest(); @@ -139,6 +136,9 @@ namespace CSVDoc void updateTitle(); + // called when subviews are added or removed + void updateSubViewIndicies (SubView *view = 0); + private slots: void newView();