1 // Commit: 5c783d0a9a912816813945387903857a314040b5
2 /****************************************************************************
4 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
5 ** Contact: http://www.qt-project.org/
7 ** This file is part of the QtDeclarative module of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
41 ****************************************************************************/
43 #ifndef QQUICKITEM_P_H
44 #define QQUICKITEM_P_H
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.
57 #include "qquickitem.h"
59 #include "qquickanchors_p.h"
60 #include "qquickanchors_p_p.h"
61 #include "qquickitemchangelistener_p.h"
63 #include "qquickcanvas_p.h"
65 #include <QtQuick/qsgnode.h>
66 #include "qquickclipnode_p.h"
68 #include <private/qpodvector_p.h>
69 #include <QtQuick/private/qdeclarativestate_p.h>
70 #include <private/qdeclarativenullablevalue_p_p.h>
71 #include <private/qdeclarativenotifier_p.h>
72 #include <private/qdeclarativeglobal_p.h>
74 #include <qdeclarative.h>
75 #include <qdeclarativecontext.h>
77 #include <QtCore/qlist.h>
78 #include <QtCore/qdebug.h>
79 #include <QtCore/qelapsedtimer.h>
81 #include <QtQuick/private/qquickshadereffectsource_p.h>
82 #include <QtQuick/private/qquickshadereffect_p.h>
87 class QQuickItemKeyFilter;
88 class QQuickLayoutMirroringAttached;
89 class QQuickScreenAttached;
91 class QQuickContents : public QQuickItemChangeListener
94 QQuickContents(QQuickItem *item);
97 QRectF rectF() const { return QRectF(m_x, m_y, m_width, m_height); }
99 inline void calcGeometry(QQuickItem *changed = 0);
103 void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry);
104 void itemDestroyed(QQuickItem *item);
105 void itemChildAdded(QQuickItem *, QQuickItem *);
106 void itemChildRemoved(QQuickItem *, QQuickItem *);
107 //void itemVisibilityChanged(QQuickItem *item)
110 bool calcHeight(QQuickItem *changed = 0);
111 bool calcWidth(QQuickItem *changed = 0);
121 void QQuickContents::calcGeometry(QQuickItem *changed)
123 bool wChanged = calcWidth(changed);
124 bool hChanged = calcHeight(changed);
125 if (wChanged || hChanged)
129 class QQuickTransformPrivate : public QObjectPrivate
131 Q_DECLARE_PUBLIC(QQuickTransform);
133 static QQuickTransformPrivate* get(QQuickTransform *transform) { return transform->d_func(); }
135 QQuickTransformPrivate();
137 QList<QQuickItem *> items;
141 class QQuickItemLayer : public QObject, public QQuickItemChangeListener
144 Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
145 Q_PROPERTY(QSize textureSize READ size WRITE setSize NOTIFY sizeChanged)
146 Q_PROPERTY(QRectF sourceRect READ sourceRect WRITE setSourceRect NOTIFY sourceRectChanged)
147 Q_PROPERTY(bool mipmap READ mipmap WRITE setMipmap NOTIFY mipmapChanged)
148 Q_PROPERTY(bool smooth READ smooth WRITE setSmooth NOTIFY smoothChanged)
149 Q_PROPERTY(QQuickShaderEffectSource::WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged)
150 Q_PROPERTY(QQuickShaderEffectSource::Format format READ format WRITE setFormat NOTIFY formatChanged)
151 Q_PROPERTY(QByteArray samplerName READ name WRITE setName NOTIFY nameChanged)
152 Q_PROPERTY(QDeclarativeComponent *effect READ effect WRITE setEffect NOTIFY effectChanged)
154 QQuickItemLayer(QQuickItem *item);
158 void componentComplete();
160 bool enabled() const { return m_enabled; }
161 void setEnabled(bool enabled);
163 bool mipmap() const { return m_mipmap; }
164 void setMipmap(bool mipmap);
166 bool smooth() const { return m_smooth; }
167 void setSmooth(bool s);
169 QSize size() const { return m_size; }
170 void setSize(const QSize &size);
172 QQuickShaderEffectSource::Format format() const { return m_format; }
173 void setFormat(QQuickShaderEffectSource::Format f);
175 QRectF sourceRect() const { return m_sourceRect; }
176 void setSourceRect(const QRectF &sourceRect);
178 QQuickShaderEffectSource::WrapMode wrapMode() const { return m_wrapMode; }
179 void setWrapMode(QQuickShaderEffectSource::WrapMode mode);
181 QByteArray name() const { return m_name; }
182 void setName(const QByteArray &name);
184 QDeclarativeComponent *effect() const { return m_effectComponent; }
185 void setEffect(QDeclarativeComponent *effect);
187 QQuickShaderEffectSource *effectSource() const { return m_effectSource; }
189 void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &);
190 void itemOpacityChanged(QQuickItem *);
191 void itemParentChanged(QQuickItem *, QQuickItem *);
192 void itemSiblingOrderChanged(QQuickItem *);
193 void itemVisibilityChanged(QQuickItem *);
196 void updateGeometry();
197 void updateOpacity();
201 void enabledChanged(bool enabled);
202 void sizeChanged(const QSize &size);
203 void mipmapChanged(bool mipmap);
204 void wrapModeChanged(QQuickShaderEffectSource::WrapMode mode);
205 void nameChanged(const QByteArray &name);
206 void effectChanged(QDeclarativeComponent *component);
207 void smoothChanged(bool smooth);
208 void formatChanged(QQuickShaderEffectSource::Format format);
209 void sourceRectChanged(const QRectF &sourceRect);
214 void activateEffect();
215 void deactivateEffect();
221 bool m_componentComplete;
222 QQuickShaderEffectSource::WrapMode m_wrapMode;
223 QQuickShaderEffectSource::Format m_format;
227 QDeclarativeComponent *m_effectComponent;
228 QQuickItem *m_effect;
229 QQuickShaderEffectSource *m_effectSource;
232 class Q_QUICK_EXPORT QQuickItemPrivate : public QObjectPrivate
234 Q_DECLARE_PUBLIC(QQuickItem)
237 static QQuickItemPrivate* get(QQuickItem *item) { return item->d_func(); }
238 static const QQuickItemPrivate* get(const QQuickItem *item) { return item->d_func(); }
240 static void registerAccessorProperties();
243 ~QQuickItemPrivate();
244 void init(QQuickItem *parent);
246 QDeclarativeListProperty<QObject> data();
247 QDeclarativeListProperty<QObject> resources();
248 QDeclarativeListProperty<QQuickItem> children();
250 QDeclarativeListProperty<QDeclarativeState> states();
251 QDeclarativeListProperty<QDeclarativeTransition> transitions();
253 QString state() const;
254 void setState(const QString &);
256 QQuickAnchorLine left() const;
257 QQuickAnchorLine right() const;
258 QQuickAnchorLine horizontalCenter() const;
259 QQuickAnchorLine top() const;
260 QQuickAnchorLine bottom() const;
261 QQuickAnchorLine verticalCenter() const;
262 QQuickAnchorLine baseline() const;
264 QQuickItemLayer *layer() const;
267 static void data_append(QDeclarativeListProperty<QObject> *, QObject *);
268 static int data_count(QDeclarativeListProperty<QObject> *);
269 static QObject *data_at(QDeclarativeListProperty<QObject> *, int);
270 static void data_clear(QDeclarativeListProperty<QObject> *);
272 // resources property
273 static QObject *resources_at(QDeclarativeListProperty<QObject> *, int);
274 static void resources_append(QDeclarativeListProperty<QObject> *, QObject *);
275 static int resources_count(QDeclarativeListProperty<QObject> *);
276 static void resources_clear(QDeclarativeListProperty<QObject> *);
279 static void children_append(QDeclarativeListProperty<QQuickItem> *, QQuickItem *);
280 static int children_count(QDeclarativeListProperty<QQuickItem> *);
281 static QQuickItem *children_at(QDeclarativeListProperty<QQuickItem> *, int);
282 static void children_clear(QDeclarativeListProperty<QQuickItem> *);
284 // transform property
285 static int transform_count(QDeclarativeListProperty<QQuickTransform> *list);
286 static void transform_append(QDeclarativeListProperty<QQuickTransform> *list, QQuickTransform *);
287 static QQuickTransform *transform_at(QDeclarativeListProperty<QQuickTransform> *list, int);
288 static void transform_clear(QDeclarativeListProperty<QQuickTransform> *list);
290 QQuickAnchors *anchors() const;
291 mutable QQuickAnchors *_anchors;
292 QQuickContents *_contents;
294 QDeclarativeNullableValue<qreal> baselineOffset;
297 AnchorLines(QQuickItem *);
298 QQuickAnchorLine left;
299 QQuickAnchorLine right;
300 QQuickAnchorLine hCenter;
301 QQuickAnchorLine top;
302 QQuickAnchorLine bottom;
303 QQuickAnchorLine vCenter;
304 QQuickAnchorLine baseline;
306 mutable AnchorLines *_anchorLines;
307 AnchorLines *anchorLines() const;
320 Q_DECLARE_FLAGS(ChangeTypes, ChangeType)
322 enum GeometryChangeType {
328 SizeChange = WidthChange | HeightChange,
329 GeometryChange = XChange | YChange | SizeChange
332 Q_DECLARE_FLAGS(GeometryChangeTypes, GeometryChangeType)
334 struct ChangeListener {
335 ChangeListener(QQuickItemChangeListener *l, QQuickItemPrivate::ChangeTypes t) : listener(l), types(t), gTypes(GeometryChange) {}
336 ChangeListener(QQuickItemChangeListener *l, QQuickItemPrivate::GeometryChangeTypes gt) : listener(l), types(Geometry), gTypes(gt) {}
337 QQuickItemChangeListener *listener;
338 QQuickItemPrivate::ChangeTypes types;
339 QQuickItemPrivate::GeometryChangeTypes gTypes; //NOTE: not used for ==
340 bool operator==(const ChangeListener &other) const { return listener == other.listener && types == other.types; }
343 void addItemChangeListener(QQuickItemChangeListener *listener, ChangeTypes types) {
344 changeListeners.append(ChangeListener(listener, types));
346 void removeItemChangeListener(QQuickItemChangeListener *, ChangeTypes types);
347 void updateOrAddGeometryChangeListener(QQuickItemChangeListener *listener, GeometryChangeTypes types);
348 void updateOrRemoveGeometryChangeListener(QQuickItemChangeListener *listener, GeometryChangeTypes types);
349 QPODVector<ChangeListener,4> changeListeners;
351 QDeclarativeStateGroup *_states();
352 QDeclarativeStateGroup *_stateGroup;
354 QQuickItem::TransformOrigin origin:5;
358 bool componentComplete:1;
365 bool notifiedFocus:1;
366 bool notifiedActiveFocus:1;
367 bool filtersChildMouseEvents:1;
368 bool explicitVisible:1;
369 bool effectiveVisible:1;
370 bool explicitEnable:1;
371 bool effectiveEnable:1;
372 bool polishScheduled:1;
373 bool inheritedLayoutMirror:1;
374 bool effectiveLayoutMirror:1;
375 bool isMirrorImplicit:1;
376 bool inheritMirrorFromParent:1;
377 bool inheritMirrorFromItem:1;
378 bool childrenDoNotOverlap:1;
379 bool staticSubtreeGeometry:1;
382 QQuickCanvas *canvas;
383 QSGContext *sceneGraphContext() const { Q_ASSERT(canvas); return static_cast<QQuickCanvasPrivate *>(QObjectPrivate::get(canvas))->context; }
385 QQuickItem *parentItem;
386 QDeclarativeNotifier parentNotifier;
388 QList<QQuickItem *> childItems;
389 mutable QList<QQuickItem *> *sortedChildItems;
390 QList<QQuickItem *> paintOrderChildItems() const;
391 void addChild(QQuickItem *);
392 void removeChild(QQuickItem *);
393 void siblingOrderChanged();
395 inline void markSortedChildrenDirty(QQuickItem *child) {
396 // If sortedChildItems == &childItems then all in childItems have z == 0
397 // and we don't need to invalidate if the changed item also has z == 0.
398 if (child->z() != 0. || sortedChildItems != &childItems) {
399 if (sortedChildItems != &childItems)
400 delete sortedChildItems;
401 sortedChildItems = 0;
405 class InitializationState {
407 QQuickItem *getFocusScope(QQuickItem *item);
409 void clear(QQuickItem *focusScope);
411 QQuickItem *focusScope;
413 void initCanvas(InitializationState *, QQuickCanvas *);
415 QQuickItem *subFocusItem;
417 QTransform canvasToItemTransform() const;
418 QTransform itemToCanvasTransform() const;
419 void itemToParentTransform(QTransform &) const;
426 qreal implicitHeight;
433 QQuickLayoutMirroringAttached* attachedLayoutDirection;
435 Qt::MouseButtons acceptedMouseButtons;
436 Qt::InputMethodHints imHints;
438 void setAccessibleFlagAndListener();
440 QPointF transformOriginPoint;
442 virtual qreal getImplicitWidth() const;
443 virtual qreal getImplicitHeight() const;
444 virtual void implicitWidthChanged();
445 virtual void implicitHeightChanged();
447 void resolveLayoutMirror();
448 void setImplicitLayoutMirror(bool mirror, bool inherit);
449 void setLayoutMirror(bool mirror);
450 bool isMirrored() const {
451 return effectiveLayoutMirror;
454 void emitChildrenRectChanged(const QRectF &rect) {
456 emit q->childrenRectChanged(rect);
459 QPointF computeTransformOrigin() const;
460 QList<QQuickTransform *> transforms;
461 virtual void transformChanged();
463 QQuickItemKeyFilter *keyHandler;
464 void deliverKeyEvent(QKeyEvent *);
465 void deliverInputMethodEvent(QInputMethodEvent *);
466 void deliverFocusEvent(QFocusEvent *);
467 void deliverMouseEvent(QMouseEvent *);
468 void deliverWheelEvent(QWheelEvent *);
469 void deliverTouchEvent(QTouchEvent *);
470 void deliverHoverEvent(QHoverEvent *);
471 void deliverDragEvent(QEvent *);
473 bool calcEffectiveVisible() const;
474 void setEffectiveVisibleRecur(bool);
475 bool calcEffectiveEnable() const;
476 void setEffectiveEnableRecur(QQuickItem *scope, bool);
480 TransformOrigin = 0x00000001,
481 Transform = 0x00000002,
482 BasicTransform = 0x00000004,
483 Position = 0x00000008,
487 Content = 0x00000040,
489 OpacityValue = 0x00000100,
490 ChildrenChanged = 0x00000200,
491 ChildrenStackingChanged = 0x00000400,
492 ParentChanged = 0x00000800,
497 EffectReference = 0x00008000,
498 Visible = 0x00010000,
499 HideReference = 0x00020000,
500 PerformanceHints = 0x00040000,
501 // When you add an attribute here, don't forget to update
504 TransformUpdateMask = TransformOrigin | Transform | BasicTransform | Position | Size | Canvas,
505 ComplexTransformUpdateMask = Transform | Canvas,
506 ContentUpdateMask = Size | Content | Smooth | Canvas,
507 ChildrenUpdateMask = ChildrenChanged | ChildrenStackingChanged | EffectReference | Canvas
510 quint32 dirtyAttributes;
511 QString dirtyToString() const;
512 void dirty(DirtyType);
513 void addToDirtyList();
514 void removeFromDirtyList();
515 QQuickItem *nextDirtyItem;
516 QQuickItem**prevDirtyItem;
518 inline QSGTransformNode *itemNode();
519 inline QSGNode *childContainerNode();
530 QSGTransformNode *itemNodeInstance;
531 QSGOpacityNode *opacityNode;
532 QQuickDefaultClipNode *clipNode;
533 QSGRootNode *rootNode;
536 QSGNode *beforePaintNode;
538 virtual QSGTransformNode *createTransformNode();
540 // A reference from an effect item means that this item is used by the effect, so
541 // it should insert a root node.
542 void refFromEffectItem(bool hide);
543 void derefFromEffectItem(bool unhide);
547 void itemChange(QQuickItem::ItemChange, const QQuickItem::ItemChangeData &);
549 virtual void mirrorChange() {}
551 QQuickScreenAttached *screenAttached;
553 mutable QQuickItemLayer *_layer;
555 static qint64 consistentTime;
556 static void setConsistentTime(qint64 t);
557 static void start(QElapsedTimer &);
558 static qint64 elapsed(QElapsedTimer &);
559 static qint64 restart(QElapsedTimer &);
563 Key filters can be installed on a QQuickItem, but not removed. Currently they
564 are only used by attached objects (which are only destroyed on Item
565 destruction), so this isn't a problem. If in future this becomes any form
566 of public API, they will have to support removal too.
568 class QQuickItemKeyFilter
571 QQuickItemKeyFilter(QQuickItem * = 0);
572 virtual ~QQuickItemKeyFilter();
574 virtual void keyPressed(QKeyEvent *event, bool post);
575 virtual void keyReleased(QKeyEvent *event, bool post);
576 virtual void inputMethodEvent(QInputMethodEvent *event, bool post);
577 virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
578 virtual void componentComplete();
583 QQuickItemKeyFilter *m_next;
586 class QQuickKeyNavigationAttachedPrivate : public QObjectPrivate
589 QQuickKeyNavigationAttachedPrivate()
591 left(0), right(0), up(0), down(0), tab(0), backtab(0),
592 leftSet(false), rightSet(false), upSet(false), downSet(false),
593 tabSet(false), backtabSet(false) {}
609 class QQuickKeyNavigationAttached : public QObject, public QQuickItemKeyFilter
612 Q_DECLARE_PRIVATE(QQuickKeyNavigationAttached)
614 Q_PROPERTY(QQuickItem *left READ left WRITE setLeft NOTIFY leftChanged)
615 Q_PROPERTY(QQuickItem *right READ right WRITE setRight NOTIFY rightChanged)
616 Q_PROPERTY(QQuickItem *up READ up WRITE setUp NOTIFY upChanged)
617 Q_PROPERTY(QQuickItem *down READ down WRITE setDown NOTIFY downChanged)
618 Q_PROPERTY(QQuickItem *tab READ tab WRITE setTab NOTIFY tabChanged)
619 Q_PROPERTY(QQuickItem *backtab READ backtab WRITE setBacktab NOTIFY backtabChanged)
620 Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged)
625 QQuickKeyNavigationAttached(QObject * = 0);
627 QQuickItem *left() const;
628 void setLeft(QQuickItem *);
629 QQuickItem *right() const;
630 void setRight(QQuickItem *);
631 QQuickItem *up() const;
632 void setUp(QQuickItem *);
633 QQuickItem *down() const;
634 void setDown(QQuickItem *);
635 QQuickItem *tab() const;
636 void setTab(QQuickItem *);
637 QQuickItem *backtab() const;
638 void setBacktab(QQuickItem *);
640 enum Priority { BeforeItem, AfterItem };
641 Priority priority() const;
642 void setPriority(Priority);
644 static QQuickKeyNavigationAttached *qmlAttachedProperties(QObject *);
652 void backtabChanged();
653 void priorityChanged();
656 virtual void keyPressed(QKeyEvent *event, bool post);
657 virtual void keyReleased(QKeyEvent *event, bool post);
658 void setFocusNavigation(QQuickItem *currentItem, const char *dir);
661 class QQuickLayoutMirroringAttached : public QObject
664 Q_PROPERTY(bool enabled READ enabled WRITE setEnabled RESET resetEnabled NOTIFY enabledChanged)
665 Q_PROPERTY(bool childrenInherit READ childrenInherit WRITE setChildrenInherit NOTIFY childrenInheritChanged)
668 explicit QQuickLayoutMirroringAttached(QObject *parent = 0);
670 bool enabled() const;
671 void setEnabled(bool);
674 bool childrenInherit() const;
675 void setChildrenInherit(bool);
677 static QQuickLayoutMirroringAttached *qmlAttachedProperties(QObject *);
679 void enabledChanged();
680 void childrenInheritChanged();
682 friend class QQuickItemPrivate;
683 QQuickItemPrivate *itemPrivate;
686 class QQuickKeysAttachedPrivate : public QObjectPrivate
689 QQuickKeysAttachedPrivate()
690 : QObjectPrivate(), inPress(false), inRelease(false)
691 , inIM(false), enabled(true), imeItem(0), item(0)
694 bool isConnected(const char *signalName);
704 QList<QQuickItem *> targets;
708 class QQuickKeysAttached : public QObject, public QQuickItemKeyFilter
711 Q_DECLARE_PRIVATE(QQuickKeysAttached)
713 Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
714 Q_PROPERTY(QDeclarativeListProperty<QQuickItem> forwardTo READ forwardTo)
715 Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged)
720 QQuickKeysAttached(QObject *parent=0);
721 ~QQuickKeysAttached();
723 bool enabled() const { Q_D(const QQuickKeysAttached); return d->enabled; }
724 void setEnabled(bool enabled) {
725 Q_D(QQuickKeysAttached);
726 if (enabled != d->enabled) {
727 d->enabled = enabled;
728 emit enabledChanged();
732 enum Priority { BeforeItem, AfterItem};
733 Priority priority() const;
734 void setPriority(Priority);
736 QDeclarativeListProperty<QQuickItem> forwardTo() {
737 Q_D(QQuickKeysAttached);
738 return QDeclarativeListProperty<QQuickItem>(this, d->targets);
741 virtual void componentComplete();
743 static QQuickKeysAttached *qmlAttachedProperties(QObject *);
746 void enabledChanged();
747 void priorityChanged();
748 void pressed(QQuickKeyEvent *event);
749 void released(QQuickKeyEvent *event);
750 void digit0Pressed(QQuickKeyEvent *event);
751 void digit1Pressed(QQuickKeyEvent *event);
752 void digit2Pressed(QQuickKeyEvent *event);
753 void digit3Pressed(QQuickKeyEvent *event);
754 void digit4Pressed(QQuickKeyEvent *event);
755 void digit5Pressed(QQuickKeyEvent *event);
756 void digit6Pressed(QQuickKeyEvent *event);
757 void digit7Pressed(QQuickKeyEvent *event);
758 void digit8Pressed(QQuickKeyEvent *event);
759 void digit9Pressed(QQuickKeyEvent *event);
761 void leftPressed(QQuickKeyEvent *event);
762 void rightPressed(QQuickKeyEvent *event);
763 void upPressed(QQuickKeyEvent *event);
764 void downPressed(QQuickKeyEvent *event);
765 void tabPressed(QQuickKeyEvent *event);
766 void backtabPressed(QQuickKeyEvent *event);
768 void asteriskPressed(QQuickKeyEvent *event);
769 void numberSignPressed(QQuickKeyEvent *event);
770 void escapePressed(QQuickKeyEvent *event);
771 void returnPressed(QQuickKeyEvent *event);
772 void enterPressed(QQuickKeyEvent *event);
773 void deletePressed(QQuickKeyEvent *event);
774 void spacePressed(QQuickKeyEvent *event);
775 void backPressed(QQuickKeyEvent *event);
776 void cancelPressed(QQuickKeyEvent *event);
777 void selectPressed(QQuickKeyEvent *event);
778 void yesPressed(QQuickKeyEvent *event);
779 void noPressed(QQuickKeyEvent *event);
780 void context1Pressed(QQuickKeyEvent *event);
781 void context2Pressed(QQuickKeyEvent *event);
782 void context3Pressed(QQuickKeyEvent *event);
783 void context4Pressed(QQuickKeyEvent *event);
784 void callPressed(QQuickKeyEvent *event);
785 void hangupPressed(QQuickKeyEvent *event);
786 void flipPressed(QQuickKeyEvent *event);
787 void menuPressed(QQuickKeyEvent *event);
788 void volumeUpPressed(QQuickKeyEvent *event);
789 void volumeDownPressed(QQuickKeyEvent *event);
792 virtual void keyPressed(QKeyEvent *event, bool post);
793 virtual void keyReleased(QKeyEvent *event, bool post);
794 virtual void inputMethodEvent(QInputMethodEvent *, bool post);
795 virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
797 const QByteArray keyToSignal(int key) {
798 QByteArray keySignal;
799 if (key >= Qt::Key_0 && key <= Qt::Key_9) {
800 keySignal = "digit0Pressed";
801 keySignal[5] = '0' + (key - Qt::Key_0);
804 while (sigMap[i].key && sigMap[i].key != key)
806 keySignal = sigMap[i].sig;
816 static const SigMap sigMap[];
819 QSGTransformNode *QQuickItemPrivate::itemNode()
821 if (!itemNodeInstance) {
822 itemNodeInstance = createTransformNode();
823 itemNodeInstance->setFlag(QSGNode::OwnedByParent, false);
824 #ifdef QML_RUNTIME_TESTING
826 itemNodeInstance->description = QString::fromLatin1("QQuickItem(%1)").arg(QString::fromLatin1(q->metaObject()->className()));
829 return itemNodeInstance;
832 QSGNode *QQuickItemPrivate::childContainerNode()
835 groupNode = new QSGNode();
837 rootNode->appendChildNode(groupNode);
839 clipNode->appendChildNode(groupNode);
840 else if (opacityNode)
841 opacityNode->appendChildNode(groupNode);
843 itemNode()->appendChildNode(groupNode);
844 groupNode->setFlag(QSGNode::ChildrenDoNotOverlap, childrenDoNotOverlap);
845 groupNode->setFlag(QSGNode::StaticSubtreeGeometry, staticSubtreeGeometry);
846 #ifdef QML_RUNTIME_TESTING
847 groupNode->description = QLatin1String("group");
853 Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickItemPrivate::ChangeTypes);
857 QML_DECLARE_TYPE(QQuickItemLayer)
858 QML_DECLARE_TYPE(QQuickKeysAttached)
859 QML_DECLARE_TYPEINFO(QQuickKeysAttached, QML_HAS_ATTACHED_PROPERTIES)
860 QML_DECLARE_TYPE(QQuickKeyNavigationAttached)
861 QML_DECLARE_TYPEINFO(QQuickKeyNavigationAttached, QML_HAS_ATTACHED_PROPERTIES)
862 QML_DECLARE_TYPE(QQuickLayoutMirroringAttached)
863 QML_DECLARE_TYPEINFO(QQuickLayoutMirroringAttached, QML_HAS_ATTACHED_PROPERTIES)
865 #endif // QQUICKITEM_P_H