summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsitem.h
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2010-03-24 04:33:21 (GMT)
committerAlexis Menard <alexis.menard@nokia.com>2010-03-24 08:29:00 (GMT)
commit4be83fa7337c5a4eb7b0ce085aa5854af5d33252 (patch)
tree39771d3ff7b1c2b3f64934f0e344f50cca497610 /src/gui/graphicsview/qgraphicsitem.h
parentc8fa23a5edd790d9eed0620068a29e03e4202cac (diff)
downloadQt-4be83fa7337c5a4eb7b0ce085aa5854af5d33252.zip
Qt-4be83fa7337c5a4eb7b0ce085aa5854af5d33252.tar.gz
Qt-4be83fa7337c5a4eb7b0ce085aa5854af5d33252.tar.bz2
Add a children private property needed for QML to support QGraphicsObject
Commit adds a private property that QML can use to add children for a given item. This is a custom list that calls a callback which actually reparent the item instead of just appending in the list (otherwise it will mess up the state of QGraphicsView). This is needed because childItems() is pretty useless you get a list but if you append something on it then it adds that into a copy. Also the children property is the default property a concept used by QML. Width and Height private properties has been added in order to support better the integration with QGraphicsWidget in QML. The actual implementation is in the private class of QGI and QGraphicsWidget reimplements it to return the geometry. (In 4.7 QDeclarativeItem reimplements it too). This change should be harmless everything is private. Task-number:QT-2757 Reviewed-by:andreas
Diffstat (limited to 'src/gui/graphicsview/qgraphicsitem.h')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h
index d72833b..5023f60 100644
--- a/src/gui/graphicsview/qgraphicsitem.h
+++ b/src/gui/graphicsview/qgraphicsitem.h
@@ -547,6 +547,10 @@ class Q_GUI_EXPORT QGraphicsObject : public QObject, public QGraphicsItem
Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged)
Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged)
Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint WRITE setTransformOriginPoint)
+ Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), QDeclarativeListProperty<QGraphicsObject> children READ childrenList DESIGNABLE false NOTIFY childrenChanged)
+ Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), qreal width READ width WRITE setWidth NOTIFY widthChanged RESET resetWidth FINAL)
+ Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), qreal height READ height WRITE setHeight NOTIFY heightChanged RESET resetHeight FINAL)
+ Q_CLASSINFO("DefaultProperty", "children")
Q_INTERFACES(QGraphicsItem)
public:
QGraphicsObject(QGraphicsItem *parent = 0);
@@ -571,6 +575,9 @@ Q_SIGNALS:
void zChanged();
void rotationChanged();
void scaleChanged();
+ void childrenChanged();
+ void widthChanged();
+ void heightChanged();
protected:
QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene);