summaryrefslogtreecommitdiffstats
path: root/pokemodr/PokemodTree.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pokemodr/PokemodTree.cpp')
-rw-r--r--pokemodr/PokemodTree.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/pokemodr/PokemodTree.cpp b/pokemodr/PokemodTree.cpp
index e075af83..8b7712d5 100644
--- a/pokemodr/PokemodTree.cpp
+++ b/pokemodr/PokemodTree.cpp
@@ -30,7 +30,36 @@ PokemodTree::PokemodTree(QWidget* parent) :
header()->hide();
}
+QString PokemodTree::description(const QModelIndex& index)
+{
+ return QString("%1: %2").arg(model()->data(index, BaseModel::TypeRole).toString()).arg(model()->data(index, Qt::DisplayRole).toString());
+}
+
QWidget* PokemodTree::editorWidget(const QModelIndex& index)
{
return model()->data(index, BaseModel::WidgetRole).value<QWidget*>();
}
+
+KMenu* PokemodTree::contextMenu(const QModelIndex& index)
+{
+ // FIXME: QVariant cant get a KMenu* out of it
+ return static_cast<KMenu*>(model()->data(index, BaseModel::ContextMenuRole).value<void*>());
+}
+
+QDomDocument PokemodTree::cut(const QModelIndex& index)
+{
+ // TODO: actually cut out the item
+ return copy(index);
+}
+
+QDomDocument PokemodTree::copy(const QModelIndex& index)
+{
+ QDomDocument xml;
+ xml.setContent(model()->data(index, BaseModel::XmlRole).toString());
+ return xml;
+}
+
+void PokemodTree::paste(const QModelIndex& index, const QDomDocument& data)
+{
+ model()->setData(index, data.toString(), BaseModel::XmlRole);
+}