Changed: #1302 Added methods for keeping graphics data (QGraphicsItem and future the 3d_WorldEditor classes).

--HG--
branch : gsoc2011-worldeditorqt
This commit is contained in:
dnk-88 2011-08-08 22:07:04 +03:00
parent 9e3fd003d6
commit 4c9614d841
2 changed files with 18 additions and 1 deletions

View file

@ -132,6 +132,16 @@ void Node::setData(int key, const QVariant &data)
m_data[key] = data; m_data[key] = data;
} }
void Node::setGraphicsData(int key, void *pointerToData)
{
m_graphicsData[key] = pointerToData;
}
void *Node::graphicsData(int key) const
{
return m_graphicsData[key];
}
Node *Node::parent() Node *Node::parent()
{ {
return m_parent; return m_parent;

View file

@ -30,12 +30,14 @@
namespace WorldEditor namespace WorldEditor
{ {
class WorldEditNode; class WorldEditNode;
class RootPrimitiveNode; class RootPrimitiveNode;
class LandscapeNode; class LandscapeNode;
class PrimitiveNode; class PrimitiveNode;
const int GRAPHICS_DATA_QT2D = 0;
const int GRAPHICS_DATA_NEL3D = 1;
/* /*
@class Node @class Node
@brief @brief
@ -91,6 +93,10 @@ public:
/// Return this node's custom data for the key key as a QVariant. /// Return this node's custom data for the key key as a QVariant.
QVariant data(int key) const; QVariant data(int key) const;
void setGraphicsData(int key, void *pointerToData);
void *graphicsData(int key) const;
/// Return a type this node. /// Return a type this node.
virtual NodeType type() const; virtual NodeType type() const;
@ -100,6 +106,7 @@ private:
Node *m_parent; Node *m_parent;
QList<Node *> m_children; QList<Node *> m_children;
QHash<int, QVariant> m_data; QHash<int, QVariant> m_data;
QHash<int, void *> m_graphicsData;
}; };
/* /*