diff options
| -rw-r--r-- | sigmodr/tree/TreeWidget.cpp | 17 | ||||
| -rw-r--r-- | sigmodr/tree/TreeWidget.h | 4 |
2 files changed, 7 insertions, 14 deletions
diff --git a/sigmodr/tree/TreeWidget.cpp b/sigmodr/tree/TreeWidget.cpp index 383f473a..85d2973c 100644 --- a/sigmodr/tree/TreeWidget.cpp +++ b/sigmodr/tree/TreeWidget.cpp @@ -60,18 +60,11 @@ ObjectUI* TreeWidget::editorWidget(const QModelIndex& index) return widget; } -// const Game* TreeWidget::currentGame() const -// { -// QModelIndex index = currentIndex(); -// if (index.isValid()) -// { -// const Object* object = static_cast<BaseModel*>(index.internalPointer())->object(); -// if (object) -// return object->game(); -// } -// return NULL; -// } -// +const Game* TreeWidget::currentGame() const +{ + return qobject_cast<TreeModel*>(model())->findGame(currentIndex()); +} + // QDomDocument TreeWidget::copy(const QModelIndex& index) // { // QDomDocument xml; diff --git a/sigmodr/tree/TreeWidget.h b/sigmodr/tree/TreeWidget.h index 3898f4b2..2f81f7f8 100644 --- a/sigmodr/tree/TreeWidget.h +++ b/sigmodr/tree/TreeWidget.h @@ -55,8 +55,8 @@ class SIGMODRTREE_EXPORT TreeWidget : public QTreeView QStringList dropTypes(const QModelIndex& index) const; Widgets::ObjectUI* editorWidget(const QModelIndex& index); -// const Sigmod::Game* currentGame() const; -// + const Sigmod::Game* currentGame() const; + // QDomDocument copy(const QModelIndex& index); // void paste(const QModelIndex& index, const QDomDocument& data); // |
