mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 07:53:53 +00:00
replaced regular function call from SubView to View with signal-slot-connection
This commit is contained in:
parent
1aef9304e9
commit
6f4b753750
4 changed files with 12 additions and 10 deletions
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue