Initial import from qtquick2.
[profile/ivi/qtdeclarative.git] / src / declarative / items / qsgitem_p.h
1 // Commit: 5c783d0a9a912816813945387903857a314040b5
2 /****************************************************************************
3 **
4 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
5 ** All rights reserved.
6 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 **
8 ** This file is part of the QtDeclarative module of the Qt Toolkit.
9 **
10 ** $QT_BEGIN_LICENSE:LGPL$
11 ** No Commercial Usage
12 ** This file contains pre-release code and may not be distributed.
13 ** You may use this file in accordance with the terms and conditions
14 ** contained in the Technology Preview License Agreement accompanying
15 ** this package.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file.  Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights.  These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
31 **
32 **
33 **
34 **
35 **
36 **
37 **
38 **
39 ** $QT_END_LICENSE$
40 **
41 ****************************************************************************/
42
43 #ifndef QSGITEM_P_H
44 #define QSGITEM_P_H
45
46 //
47 //  W A R N I N G
48 //  -------------
49 //
50 // This file is not part of the Qt API.  It exists purely as an
51 // implementation detail.  This header file may change from version to
52 // version without notice, or even be removed.
53 //
54 // We mean it.
55 //
56
57 #include "qsgitem.h"
58
59 #include "qsganchors_p.h"
60 #include "qsganchors_p_p.h"
61 #include "qsgitemchangelistener_p.h"
62
63 #include "qsgcanvas_p.h"
64
65 #include "qsgnode.h"
66 #include "qsgclipnode_p.h"
67
68 #include <private/qpodvector_p.h>
69 #include <private/qdeclarativestate_p.h>
70 #include <private/qdeclarativenullablevalue_p_p.h>
71 #include <private/qdeclarativenotifier_p.h>
72 #include <private/qdeclarativeglobal_p.h>
73
74 #include <qdeclarative.h>
75 #include <qdeclarativecontext.h>
76
77 #include <QtCore/qlist.h>
78 #include <QtCore/qdebug.h>
79 #include <QtCore/qelapsedtimer.h>
80
81 QT_BEGIN_NAMESPACE
82
83 class QNetworkReply;
84 class QSGItemKeyFilter;
85 class QSGLayoutMirroringAttached;
86
87 //### merge into private?
88 class QSGContents : public QObject, public QSGItemChangeListener
89 {
90     Q_OBJECT
91 public:
92     QSGContents(QSGItem *item);
93     ~QSGContents();
94
95     QRectF rectF() const;
96
97     void childRemoved(QSGItem *item);
98     void childAdded(QSGItem *item);
99
100     void calcGeometry() { calcWidth(); calcHeight(); }
101     void complete();
102
103 Q_SIGNALS:
104     void rectChanged(QRectF);
105
106 protected:
107     void itemGeometryChanged(QSGItem *item, const QRectF &newGeometry, const QRectF &oldGeometry);
108     void itemDestroyed(QSGItem *item);
109     //void itemVisibilityChanged(QSGItem *item)
110
111 private:
112     void calcHeight(QSGItem *changed = 0);
113     void calcWidth(QSGItem *changed = 0);
114
115     QSGItem *m_item;
116     qreal m_x;
117     qreal m_y;
118     qreal m_width;
119     qreal m_height;
120 };
121
122 class QSGTransformPrivate : public QObjectPrivate
123 {
124     Q_DECLARE_PUBLIC(QSGTransform);
125 public:
126     static QSGTransformPrivate* get(QSGTransform *transform) { return transform->d_func(); }
127
128     QSGTransformPrivate();
129
130     QList<QSGItem *> items;
131 };
132
133 class Q_DECLARATIVE_EXPORT QSGItemPrivate : public QObjectPrivate
134 {
135     Q_DECLARE_PUBLIC(QSGItem)
136
137 public:
138     static QSGItemPrivate* get(QSGItem *item) { return item->d_func(); }
139     static const QSGItemPrivate* get(const QSGItem *item) { return item->d_func(); }
140
141     QSGItemPrivate();
142     void init(QSGItem *parent);
143
144     QDeclarativeListProperty<QObject> data();
145     QDeclarativeListProperty<QObject> resources();
146     QDeclarativeListProperty<QSGItem> children();
147
148     QDeclarativeListProperty<QDeclarativeState> states();
149     QDeclarativeListProperty<QDeclarativeTransition> transitions();
150
151     QString state() const;
152     void setState(const QString &);
153
154     QSGAnchorLine left() const;
155     QSGAnchorLine right() const;
156     QSGAnchorLine horizontalCenter() const;
157     QSGAnchorLine top() const;
158     QSGAnchorLine bottom() const;
159     QSGAnchorLine verticalCenter() const;
160     QSGAnchorLine baseline() const;
161
162     // data property
163     static void data_append(QDeclarativeListProperty<QObject> *, QObject *);
164     static int data_count(QDeclarativeListProperty<QObject> *);
165     static QObject *data_at(QDeclarativeListProperty<QObject> *, int);
166     static void data_clear(QDeclarativeListProperty<QObject> *);
167
168     // resources property
169     static QObject *resources_at(QDeclarativeListProperty<QObject> *, int);
170     static void resources_append(QDeclarativeListProperty<QObject> *, QObject *);
171     static int resources_count(QDeclarativeListProperty<QObject> *);
172     static void resources_clear(QDeclarativeListProperty<QObject> *);
173
174     // children property
175     static void children_append(QDeclarativeListProperty<QSGItem> *, QSGItem *);
176     static int children_count(QDeclarativeListProperty<QSGItem> *);
177     static QSGItem *children_at(QDeclarativeListProperty<QSGItem> *, int);
178     static void children_clear(QDeclarativeListProperty<QSGItem> *);
179
180     // transform property
181     static int transform_count(QDeclarativeListProperty<QSGTransform> *list);
182     static void transform_append(QDeclarativeListProperty<QSGTransform> *list, QSGTransform *);
183     static QSGTransform *transform_at(QDeclarativeListProperty<QSGTransform> *list, int);
184     static void transform_clear(QDeclarativeListProperty<QSGTransform> *list);
185
186     QSGAnchors *anchors() const;
187     mutable QSGAnchors *_anchors;
188     QSGContents *_contents;
189
190     QDeclarativeNullableValue<qreal> baselineOffset;
191
192     struct AnchorLines {
193         AnchorLines(QSGItem *);
194         QSGAnchorLine left;
195         QSGAnchorLine right;
196         QSGAnchorLine hCenter;
197         QSGAnchorLine top;
198         QSGAnchorLine bottom;
199         QSGAnchorLine vCenter;
200         QSGAnchorLine baseline;
201     };
202     mutable AnchorLines *_anchorLines;
203     AnchorLines *anchorLines() const;
204
205     enum ChangeType {
206         Geometry = 0x01,
207         SiblingOrder = 0x02,
208         Visibility = 0x04,
209         Opacity = 0x08,
210         Destroyed = 0x10,
211         Parent = 0x20,
212         Children = 0x40,
213         Rotation = 0x80,
214     };
215
216     Q_DECLARE_FLAGS(ChangeTypes, ChangeType)
217
218     struct ChangeListener {
219         ChangeListener(QSGItemChangeListener *l, QSGItemPrivate::ChangeTypes t) : listener(l), types(t) {}
220         QSGItemChangeListener *listener;
221         QSGItemPrivate::ChangeTypes types;
222         bool operator==(const ChangeListener &other) const { return listener == other.listener && types == other.types; }
223     };
224
225     void addItemChangeListener(QSGItemChangeListener *listener, ChangeTypes types) {
226         changeListeners.append(ChangeListener(listener, types));
227     }
228     void removeItemChangeListener(QSGItemChangeListener *, ChangeTypes types);
229     QPODVector<ChangeListener,4> changeListeners;
230
231     QDeclarativeStateGroup *_states();
232     QDeclarativeStateGroup *_stateGroup;
233
234     QSGItem::TransformOrigin origin:5;
235     quint32 flags:4;
236     bool widthValid:1;
237     bool heightValid:1;
238     bool componentComplete:1;
239     bool keepMouse:1;
240     bool hoverEnabled:1;
241     bool smooth:1;
242     bool focus:1;
243     bool activeFocus:1;
244     bool notifiedFocus:1;
245     bool notifiedActiveFocus:1;
246     bool filtersChildMouseEvents:1;
247     bool explicitVisible:1;
248     bool effectiveVisible:1;
249     bool explicitEnable:1;
250     bool effectiveEnable:1;
251     bool polishScheduled:1;
252     bool inheritedLayoutMirror:1;
253     bool effectiveLayoutMirror:1;
254     bool isMirrorImplicit:1;
255     bool inheritMirrorFromParent:1;
256     bool inheritMirrorFromItem:1;
257     quint32 dummy:2;
258
259     QSGCanvas *canvas;
260     QSGContext *sceneGraphContext() const { return static_cast<QSGCanvasPrivate *>(QObjectPrivate::get(canvas))->context; }
261
262     QSGItem *parentItem;
263     QList<QSGItem *> childItems;
264     QList<QSGItem *> paintOrderChildItems() const;
265     void addChild(QSGItem *);
266     void removeChild(QSGItem *);
267     void siblingOrderChanged();
268
269     class InitializationState {
270     public:
271         QSGItem *getFocusScope(QSGItem *item);
272         void clear();
273         void clear(QSGItem *focusScope);
274     private:
275         QSGItem *focusScope;
276     };
277     void initCanvas(InitializationState *, QSGCanvas *);
278
279     QSGItem *subFocusItem;
280
281     QTransform canvasToItemTransform() const;
282     QTransform itemToCanvasTransform() const;
283     void itemToParentTransform(QTransform &) const;
284
285     qreal x;
286     qreal y;
287     qreal width;
288     qreal height;
289     qreal implicitWidth;
290     qreal implicitHeight;
291
292     qreal z;
293     qreal scale;
294     qreal rotation;
295     qreal opacity;
296
297     QSGLayoutMirroringAttached* attachedLayoutDirection;
298
299     Qt::MouseButtons acceptedMouseButtons;
300     Qt::InputMethodHints imHints;
301
302     virtual qreal getImplicitWidth() const;
303     virtual qreal getImplicitHeight() const;
304     virtual void implicitWidthChanged();
305     virtual void implicitHeightChanged();
306
307     void resolveLayoutMirror();
308     void setImplicitLayoutMirror(bool mirror, bool inherit);
309     void setLayoutMirror(bool mirror);
310     bool isMirrored() const {
311         return effectiveLayoutMirror;
312     }
313
314     QPointF computeTransformOrigin() const;
315     QList<QSGTransform *> transforms;
316     virtual void transformChanged();
317
318     QSGItemKeyFilter *keyHandler;
319     void deliverKeyEvent(QKeyEvent *);
320     void deliverInputMethodEvent(QInputMethodEvent *);
321     void deliverFocusEvent(QFocusEvent *);
322     void deliverMouseEvent(QGraphicsSceneMouseEvent *);
323     void deliverWheelEvent(QGraphicsSceneWheelEvent *);
324     void deliverTouchEvent(QTouchEvent *);
325     void deliverHoverEvent(QGraphicsSceneHoverEvent *);
326
327     bool calcEffectiveVisible() const;
328     void setEffectiveVisibleRecur(bool);
329     bool calcEffectiveEnable() const;
330     void setEffectiveEnableRecur(bool);
331
332     // XXX todo
333     enum DirtyType {
334         TransformOrigin         = 0x00000001,
335         Transform               = 0x00000002,
336         BasicTransform          = 0x00000004,
337         Position                = 0x00000008,
338         Size                    = 0x00000010,
339
340         ZValue                  = 0x00000020,
341         Content                 = 0x00000040,
342         Smooth                  = 0x00000080,
343         OpacityValue            = 0x00000100,
344         ChildrenChanged         = 0x00000200,
345         ChildrenStackingChanged = 0x00000400,
346         ParentChanged           = 0x00000800,
347
348         Clip                    = 0x00001000,
349         Canvas                  = 0x00002000,
350
351         EffectReference         = 0x00008000,
352         Visible                 = 0x00010000,
353         HideReference           = 0x00020000,
354         // When you add an attribute here, don't forget to update
355         // dirtyToString()
356
357         TransformUpdateMask     = TransformOrigin | Transform | BasicTransform | Position | Size | Canvas,
358         ComplexTransformUpdateMask     = Transform | Canvas,
359         ContentUpdateMask       = Size | Content | Smooth | Canvas,
360         ChildrenUpdateMask      = ChildrenChanged | ChildrenStackingChanged | EffectReference | Canvas,
361
362     };
363     quint32 dirtyAttributes;
364     QString dirtyToString() const;
365     void dirty(DirtyType);
366     void addToDirtyList();
367     void removeFromDirtyList();
368     QSGItem *nextDirtyItem;
369     QSGItem**prevDirtyItem;
370
371     inline QSGTransformNode *itemNode();
372     inline QSGNode *childContainerNode();
373
374     /*
375       QSGNode order is:
376          - itemNode
377          - (opacityNode)
378          - (clipNode)
379          - (effectNode)
380          - groupNode
381      */
382
383     QSGTransformNode *itemNodeInstance;
384     QSGOpacityNode *opacityNode;
385     QSGDefaultClipNode *clipNode;
386     QSGRootNode *rootNode;
387     QSGNode *groupNode;
388     QSGNode *paintNode;
389     int paintNodeIndex;
390
391     virtual QSGTransformNode *createTransformNode();
392
393     // A reference from an effect item means that this item is used by the effect, so
394     // it should insert a root node.
395     void refFromEffectItem(bool hide);
396     void derefFromEffectItem(bool unhide);
397     int effectRefCount;
398     int hideRefCount;
399
400     void itemChange(QSGItem::ItemChange, const QSGItem::ItemChangeData &);
401
402     virtual void mirrorChange() {}
403
404     static qint64 consistentTime;
405     static void setConsistentTime(qint64 t);
406     static void start(QElapsedTimer &);
407     static qint64 elapsed(QElapsedTimer &);
408     static qint64 restart(QElapsedTimer &);
409 };
410
411 /*
412     Key filters can be installed on a QSGItem, but not removed.  Currently they
413     are only used by attached objects (which are only destroyed on Item
414     destruction), so this isn't a problem.  If in future this becomes any form
415     of public API, they will have to support removal too.
416 */
417 class QSGItemKeyFilter
418 {
419 public:
420     QSGItemKeyFilter(QSGItem * = 0);
421     virtual ~QSGItemKeyFilter();
422
423     virtual void keyPressed(QKeyEvent *event, bool post);
424     virtual void keyReleased(QKeyEvent *event, bool post);
425     virtual void inputMethodEvent(QInputMethodEvent *event, bool post);
426     virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
427     virtual void componentComplete();
428
429     bool m_processPost;
430
431 private:
432     QSGItemKeyFilter *m_next;
433 };
434
435 class QSGKeyNavigationAttachedPrivate : public QObjectPrivate
436 {
437 public:
438     QSGKeyNavigationAttachedPrivate()
439         : QObjectPrivate(),
440           left(0), right(0), up(0), down(0), tab(0), backtab(0),
441           leftSet(false), rightSet(false), upSet(false), downSet(false),
442           tabSet(false), backtabSet(false) {}
443
444     QSGItem *left;
445     QSGItem *right;
446     QSGItem *up;
447     QSGItem *down;
448     QSGItem *tab;
449     QSGItem *backtab;
450     bool leftSet : 1;
451     bool rightSet : 1;
452     bool upSet : 1;
453     bool downSet : 1;
454     bool tabSet : 1;
455     bool backtabSet : 1;
456 };
457
458 class QSGKeyNavigationAttached : public QObject, public QSGItemKeyFilter
459 {
460     Q_OBJECT
461     Q_DECLARE_PRIVATE(QSGKeyNavigationAttached)
462
463     Q_PROPERTY(QSGItem *left READ left WRITE setLeft NOTIFY leftChanged)
464     Q_PROPERTY(QSGItem *right READ right WRITE setRight NOTIFY rightChanged)
465     Q_PROPERTY(QSGItem *up READ up WRITE setUp NOTIFY upChanged)
466     Q_PROPERTY(QSGItem *down READ down WRITE setDown NOTIFY downChanged)
467     Q_PROPERTY(QSGItem *tab READ tab WRITE setTab NOTIFY tabChanged)
468     Q_PROPERTY(QSGItem *backtab READ backtab WRITE setBacktab NOTIFY backtabChanged)
469     Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged)
470
471     Q_ENUMS(Priority)
472
473 public:
474     QSGKeyNavigationAttached(QObject * = 0);
475
476     QSGItem *left() const;
477     void setLeft(QSGItem *);
478     QSGItem *right() const;
479     void setRight(QSGItem *);
480     QSGItem *up() const;
481     void setUp(QSGItem *);
482     QSGItem *down() const;
483     void setDown(QSGItem *);
484     QSGItem *tab() const;
485     void setTab(QSGItem *);
486     QSGItem *backtab() const;
487     void setBacktab(QSGItem *);
488
489     enum Priority { BeforeItem, AfterItem };
490     Priority priority() const;
491     void setPriority(Priority);
492
493     static QSGKeyNavigationAttached *qmlAttachedProperties(QObject *);
494
495 Q_SIGNALS:
496     void leftChanged();
497     void rightChanged();
498     void upChanged();
499     void downChanged();
500     void tabChanged();
501     void backtabChanged();
502     void priorityChanged();
503
504 private:
505     virtual void keyPressed(QKeyEvent *event, bool post);
506     virtual void keyReleased(QKeyEvent *event, bool post);
507     void setFocusNavigation(QSGItem *currentItem, const char *dir);
508 };
509
510 class QSGLayoutMirroringAttached : public QObject
511 {
512     Q_OBJECT
513     Q_PROPERTY(bool enabled READ enabled WRITE setEnabled RESET resetEnabled NOTIFY enabledChanged)
514     Q_PROPERTY(bool childrenInherit READ childrenInherit WRITE setChildrenInherit NOTIFY childrenInheritChanged)
515
516 public:
517     explicit QSGLayoutMirroringAttached(QObject *parent = 0);
518
519     bool enabled() const;
520     void setEnabled(bool);
521     void resetEnabled();
522
523     bool childrenInherit() const;
524     void setChildrenInherit(bool);
525
526     static QSGLayoutMirroringAttached *qmlAttachedProperties(QObject *);
527 Q_SIGNALS:
528     void enabledChanged();
529     void childrenInheritChanged();
530 private:
531     friend class QSGItemPrivate;
532     QSGItemPrivate *itemPrivate;
533 };
534
535 class QSGKeysAttachedPrivate : public QObjectPrivate
536 {
537 public:
538     QSGKeysAttachedPrivate()
539         : QObjectPrivate(), inPress(false), inRelease(false)
540         , inIM(false), enabled(true), imeItem(0), item(0)
541     {}
542
543     bool isConnected(const char *signalName);
544
545     //loop detection
546     bool inPress:1;
547     bool inRelease:1;
548     bool inIM:1;
549
550     bool enabled : 1;
551
552     QSGItem *imeItem;
553     QList<QSGItem *> targets;
554     QSGItem *item;
555 };
556
557 class QSGKeysAttached : public QObject, public QSGItemKeyFilter
558 {
559     Q_OBJECT
560     Q_DECLARE_PRIVATE(QSGKeysAttached)
561
562     Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
563     Q_PROPERTY(QDeclarativeListProperty<QSGItem> forwardTo READ forwardTo)
564     Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged)
565
566     Q_ENUMS(Priority)
567
568 public:
569     QSGKeysAttached(QObject *parent=0);
570     ~QSGKeysAttached();
571
572     bool enabled() const { Q_D(const QSGKeysAttached); return d->enabled; }
573     void setEnabled(bool enabled) {
574         Q_D(QSGKeysAttached);
575         if (enabled != d->enabled) {
576             d->enabled = enabled;
577             emit enabledChanged();
578         }
579     }
580
581     enum Priority { BeforeItem, AfterItem};
582     Priority priority() const;
583     void setPriority(Priority);
584
585     QDeclarativeListProperty<QSGItem> forwardTo() {
586         Q_D(QSGKeysAttached);
587         return QDeclarativeListProperty<QSGItem>(this, d->targets);
588     }
589
590     virtual void componentComplete();
591
592     static QSGKeysAttached *qmlAttachedProperties(QObject *);
593
594 Q_SIGNALS:
595     void enabledChanged();
596     void priorityChanged();
597     void pressed(QSGKeyEvent *event);
598     void released(QSGKeyEvent *event);
599     void digit0Pressed(QSGKeyEvent *event);
600     void digit1Pressed(QSGKeyEvent *event);
601     void digit2Pressed(QSGKeyEvent *event);
602     void digit3Pressed(QSGKeyEvent *event);
603     void digit4Pressed(QSGKeyEvent *event);
604     void digit5Pressed(QSGKeyEvent *event);
605     void digit6Pressed(QSGKeyEvent *event);
606     void digit7Pressed(QSGKeyEvent *event);
607     void digit8Pressed(QSGKeyEvent *event);
608     void digit9Pressed(QSGKeyEvent *event);
609
610     void leftPressed(QSGKeyEvent *event);
611     void rightPressed(QSGKeyEvent *event);
612     void upPressed(QSGKeyEvent *event);
613     void downPressed(QSGKeyEvent *event);
614     void tabPressed(QSGKeyEvent *event);
615     void backtabPressed(QSGKeyEvent *event);
616
617     void asteriskPressed(QSGKeyEvent *event);
618     void numberSignPressed(QSGKeyEvent *event);
619     void escapePressed(QSGKeyEvent *event);
620     void returnPressed(QSGKeyEvent *event);
621     void enterPressed(QSGKeyEvent *event);
622     void deletePressed(QSGKeyEvent *event);
623     void spacePressed(QSGKeyEvent *event);
624     void backPressed(QSGKeyEvent *event);
625     void cancelPressed(QSGKeyEvent *event);
626     void selectPressed(QSGKeyEvent *event);
627     void yesPressed(QSGKeyEvent *event);
628     void noPressed(QSGKeyEvent *event);
629     void context1Pressed(QSGKeyEvent *event);
630     void context2Pressed(QSGKeyEvent *event);
631     void context3Pressed(QSGKeyEvent *event);
632     void context4Pressed(QSGKeyEvent *event);
633     void callPressed(QSGKeyEvent *event);
634     void hangupPressed(QSGKeyEvent *event);
635     void flipPressed(QSGKeyEvent *event);
636     void menuPressed(QSGKeyEvent *event);
637     void volumeUpPressed(QSGKeyEvent *event);
638     void volumeDownPressed(QSGKeyEvent *event);
639
640 private:
641     virtual void keyPressed(QKeyEvent *event, bool post);
642     virtual void keyReleased(QKeyEvent *event, bool post);
643     virtual void inputMethodEvent(QInputMethodEvent *, bool post);
644     virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
645
646     const QByteArray keyToSignal(int key) {
647         QByteArray keySignal;
648         if (key >= Qt::Key_0 && key <= Qt::Key_9) {
649             keySignal = "digit0Pressed";
650             keySignal[5] = '0' + (key - Qt::Key_0);
651         } else {
652             int i = 0;
653             while (sigMap[i].key && sigMap[i].key != key)
654                 ++i;
655             keySignal = sigMap[i].sig;
656         }
657         return keySignal;
658     }
659
660     struct SigMap {
661         int key;
662         const char *sig;
663     };
664
665     static const SigMap sigMap[];
666 };
667
668 QSGTransformNode *QSGItemPrivate::itemNode()
669
670     if (!itemNodeInstance) {
671         itemNodeInstance = createTransformNode();
672 #ifdef QML_RUNTIME_TESTING
673         Q_Q(QSGItem);
674         itemNodeInstance->description = QString::fromLatin1("QSGItem(%1)").arg(QString::fromLatin1(q->metaObject()->className()));
675 #endif
676     }
677     return itemNodeInstance; 
678 }
679
680 QSGNode *QSGItemPrivate::childContainerNode()
681 {
682     if (!groupNode) {
683         groupNode = new QSGNode();
684         if (rootNode)
685             rootNode->appendChildNode(groupNode);
686         else if (clipNode)
687             clipNode->appendChildNode(groupNode);
688         else if (opacityNode)
689             opacityNode->appendChildNode(groupNode);
690         else
691             itemNode()->appendChildNode(groupNode);
692 #ifdef QML_RUNTIME_TESTING
693         groupNode->description = QLatin1String("group");
694 #endif
695     }
696     return groupNode;
697 }
698
699 Q_DECLARE_OPERATORS_FOR_FLAGS(QSGItemPrivate::ChangeTypes);
700
701 QT_END_NAMESPACE
702
703 QML_DECLARE_TYPE(QSGKeysAttached)
704 QML_DECLARE_TYPEINFO(QSGKeysAttached, QML_HAS_ATTACHED_PROPERTIES)
705 QML_DECLARE_TYPE(QSGKeyNavigationAttached)
706 QML_DECLARE_TYPEINFO(QSGKeyNavigationAttached, QML_HAS_ATTACHED_PROPERTIES)
707 QML_DECLARE_TYPE(QSGLayoutMirroringAttached)
708 QML_DECLARE_TYPEINFO(QSGLayoutMirroringAttached, QML_HAS_ATTACHED_PROPERTIES)
709
710 #endif // QSGITEM_P_H