From 054a85fdca651844f969f44755b8531ab2e962d7 Mon Sep 17 00:00:00 2001 From: Robert Bieber Date: Thu, 5 Aug 2010 00:43:33 +0000 Subject: Theme Editor: Added code generate/undo functionality to SkinViewer git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27704 a1c6a512-1295-4272-9138-f99709370657 --- utils/themeeditor/models/parsetreemodel.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'utils/themeeditor/models/parsetreemodel.cpp') diff --git a/utils/themeeditor/models/parsetreemodel.cpp b/utils/themeeditor/models/parsetreemodel.cpp index a7f04ff..01d60c8 100644 --- a/utils/themeeditor/models/parsetreemodel.cpp +++ b/utils/themeeditor/models/parsetreemodel.cpp @@ -40,7 +40,7 @@ ParseTreeModel::ParseTreeModel(const char* document, QObject* parent): this->tree = skin_parse(document); if(tree) - this->root = new ParseTreeNode(tree); + this->root = new ParseTreeNode(tree, this); else this->root = 0; @@ -77,7 +77,7 @@ QString ParseTreeModel::changeTree(const char *document) return error; } - ParseTreeNode* temp = new ParseTreeNode(test); + ParseTreeNode* temp = new ParseTreeNode(test, this); if(root) { @@ -364,3 +364,17 @@ QGraphicsScene* ParseTreeModel::render(ProjectModel* project, return scene; } + +void ParseTreeModel::paramChanged(ParseTreeNode *param) +{ + QModelIndex index = indexFromPointer(param); + emit dataChanged(index, index); +} + +QModelIndex ParseTreeModel::indexFromPointer(ParseTreeNode *p) +{ + /* Recursively finding an index for an arbitrary pointer within the tree */ + if(!p->getParent()) + return QModelIndex(); + return index(p->getRow(), 0, indexFromPointer(p->getParent())); +} -- cgit v1.1