From d505bc01195ddc4ca6e57efe42b97f1ce49d6afd Mon Sep 17 00:00:00 2001 From: Robert Bieber Date: Fri, 6 Aug 2010 05:34:01 +0000 Subject: Theme Editor: Made SBS elements in WPS documents non-interactive, which makes it a little more difficult to crash the editor git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27734 a1c6a512-1295-4272-9138-f99709370657 --- utils/themeeditor/models/parsetreemodel.cpp | 14 +++++++++++++- utils/themeeditor/models/parsetreemodel.h | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'utils/themeeditor/models') diff --git a/utils/themeeditor/models/parsetreemodel.cpp b/utils/themeeditor/models/parsetreemodel.cpp index e30d0be09d..ed5f5740c3 100644 --- a/utils/themeeditor/models/parsetreemodel.cpp +++ b/utils/themeeditor/models/parsetreemodel.cpp @@ -342,8 +342,9 @@ QGraphicsScene* ParseTreeModel::render(ProjectModel* project, sbsInfo = RBRenderInfo(sbsModel, project, doc, &settings, device, sbsScreen); sbsModel->root->render(sbsInfo); - } + setChildrenUnselectable(sbsScreen); + } } } @@ -384,3 +385,14 @@ QModelIndex ParseTreeModel::indexFromPointer(ParseTreeNode *p) return QModelIndex(); return index(p->getRow(), 0, indexFromPointer(p->getParent())); } + +void ParseTreeModel::setChildrenUnselectable(QGraphicsItem *root) +{ + root->setFlag(QGraphicsItem::ItemIsSelectable, false); + root->setFlag(QGraphicsItem::ItemIsMovable, false); + + QList children = root->children(); + for(QList::iterator i = children.begin() + ; i != children.end(); i++) + setChildrenUnselectable(*i); +} diff --git a/utils/themeeditor/models/parsetreemodel.h b/utils/themeeditor/models/parsetreemodel.h index 2c762f3645..f176b760d3 100644 --- a/utils/themeeditor/models/parsetreemodel.h +++ b/utils/themeeditor/models/parsetreemodel.h @@ -80,6 +80,8 @@ public: QModelIndex indexFromPointer(ParseTreeNode* p); private: + void setChildrenUnselectable(QGraphicsItem* root); + ParseTreeNode* root; ParseTreeModel* sbsModel; struct skin_element* tree; -- cgit v1.2.3