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();
249 QDeclarativeListProperty<QQuickItem> visibleChildren();
251 QDeclarativeListProperty<QDeclarativeState> states();
252 QDeclarativeListProperty<QDeclarativeTransition> transitions();
254 QString state() const;
255 void setState(const QString &);
257 QQuickAnchorLine left() const;
258 QQuickAnchorLine right() const;
259 QQuickAnchorLine horizontalCenter() const;
260 QQuickAnchorLine top() const;
261 QQuickAnchorLine bottom() const;
262 QQuickAnchorLine verticalCenter() const;
263 QQuickAnchorLine baseline() const;
265 QQuickItemLayer *layer() const;
268 static void data_append(QDeclarativeListProperty<QObject> *, QObject *);
269 static int data_count(QDeclarativeListProperty<QObject> *);
270 static QObject *data_at(QDeclarativeListProperty<QObject> *, int);
271 static void data_clear(QDeclarativeListProperty<QObject> *);
273 // resources property
274 static QObject *resources_at(QDeclarativeListProperty<QObject> *, int);
275 static void resources_append(QDeclarativeListProperty<QObject> *, QObject *);
276 static int resources_count(QDeclarativeListProperty<QObject> *);
277 static void resources_clear(QDeclarativeListProperty<QObject> *);
280 static void children_append(QDeclarativeListProperty<QQuickItem> *, QQuickItem *);
281 static int children_count(QDeclarativeListProperty<QQuickItem> *);
282 static QQuickItem *children_at(QDeclarativeListProperty<QQuickItem> *, int);
283 static void children_clear(QDeclarativeListProperty<QQuickItem> *);
285 // visibleChildren property
286 static void visibleChildren_append(QDeclarativeListProperty<QQuickItem> *prop, QQuickItem *o);
287 static int visibleChildren_count(QDeclarativeListProperty<QQuickItem> *prop);
288 static QQuickItem *visibleChildren_at(QDeclarativeListProperty<QQuickItem> *prop, int index);
290 // transform property
291 static int transform_count(QDeclarativeListProperty<QQuickTransform> *list);
292 static void transform_append(QDeclarativeListProperty<QQuickTransform> *list, QQuickTransform *);
293 static QQuickTransform *transform_at(QDeclarativeListProperty<QQuickTransform> *list, int);
294 static void transform_clear(QDeclarativeListProperty<QQuickTransform> *list);
296 QQuickAnchors *anchors() const;
297 mutable QQuickAnchors *_anchors;
298 QQuickContents *_contents;
300 QDeclarativeNullableValue<qreal> baselineOffset;
303 AnchorLines(QQuickItem *);
304 QQuickAnchorLine left;
305 QQuickAnchorLine right;
306 QQuickAnchorLine hCenter;
307 QQuickAnchorLine top;
308 QQuickAnchorLine bottom;
309 QQuickAnchorLine vCenter;
310 QQuickAnchorLine baseline;
312 mutable AnchorLines *_anchorLines;
313 AnchorLines *anchorLines() const;
326 Q_DECLARE_FLAGS(ChangeTypes, ChangeType)
328 enum GeometryChangeType {
334 SizeChange = WidthChange | HeightChange,
335 GeometryChange = XChange | YChange | SizeChange
338 Q_DECLARE_FLAGS(GeometryChangeTypes, GeometryChangeType)
340 struct ChangeListener {
341 ChangeListener(QQuickItemChangeListener *l, QQuickItemPrivate::ChangeTypes t) : listener(l), types(t), gTypes(GeometryChange) {}
342 ChangeListener(QQuickItemChangeListener *l, QQuickItemPrivate::GeometryChangeTypes gt) : listener(l), types(Geometry), gTypes(gt) {}
343 QQuickItemChangeListener *listener;
344 QQuickItemPrivate::ChangeTypes types;
345 QQuickItemPrivate::GeometryChangeTypes gTypes; //NOTE: not used for ==
346 bool operator==(const ChangeListener &other) const { return listener == other.listener && types == other.types; }
349 void addItemChangeListener(QQuickItemChangeListener *listener, ChangeTypes types) {
350 changeListeners.append(ChangeListener(listener, types));
352 void removeItemChangeListener(QQuickItemChangeListener *, ChangeTypes types);
353 void updateOrAddGeometryChangeListener(QQuickItemChangeListener *listener, GeometryChangeTypes types);
354 void updateOrRemoveGeometryChangeListener(QQuickItemChangeListener *listener, GeometryChangeTypes types);
355 QPODVector<ChangeListener,4> changeListeners;
357 QDeclarativeStateGroup *_states();
358 QDeclarativeStateGroup *_stateGroup;
360 QQuickItem::TransformOrigin origin:5;
364 bool componentComplete:1;
371 bool notifiedFocus:1;
372 bool notifiedActiveFocus:1;
373 bool filtersChildMouseEvents:1;
374 bool explicitVisible:1;
375 bool effectiveVisible:1;
376 bool explicitEnable:1;
377 bool effectiveEnable:1;
378 bool polishScheduled:1;
379 bool inheritedLayoutMirror:1;
380 bool effectiveLayoutMirror:1;
381 bool isMirrorImplicit:1;
382 bool inheritMirrorFromParent:1;
383 bool inheritMirrorFromItem:1;
384 bool childrenDoNotOverlap:1;
385 bool staticSubtreeGeometry:1;
388 QQuickCanvas *canvas;
389 QSGContext *sceneGraphContext() const { Q_ASSERT(canvas); return static_cast<QQuickCanvasPrivate *>(QObjectPrivate::get(canvas))->context; }
391 QQuickItem *parentItem;
392 QDeclarativeNotifier parentNotifier;
394 QList<QQuickItem *> childItems;
395 mutable QList<QQuickItem *> *sortedChildItems;
396 QList<QQuickItem *> paintOrderChildItems() const;
397 void addChild(QQuickItem *);
398 void removeChild(QQuickItem *);
399 void siblingOrderChanged();
401 inline void markSortedChildrenDirty(QQuickItem *child) {
402 // If sortedChildItems == &childItems then all in childItems have z == 0
403 // and we don't need to invalidate if the changed item also has z == 0.
404 if (child->z() != 0. || sortedChildItems != &childItems) {
405 if (sortedChildItems != &childItems)
406 delete sortedChildItems;
407 sortedChildItems = 0;
411 class InitializationState {
413 QQuickItem *getFocusScope(QQuickItem *item);
415 void clear(QQuickItem *focusScope);
417 QQuickItem *focusScope;
419 void initCanvas(InitializationState *, QQuickCanvas *);
421 QQuickItem *subFocusItem;
423 QTransform canvasToItemTransform() const;
424 QTransform itemToCanvasTransform() const;
425 void itemToParentTransform(QTransform &) const;
432 qreal implicitHeight;
439 QQuickLayoutMirroringAttached* attachedLayoutDirection;
441 Qt::MouseButtons acceptedMouseButtons;
442 Qt::InputMethodHints imHints;
444 void setAccessibleFlagAndListener();
446 QPointF transformOriginPoint;
448 virtual qreal getImplicitWidth() const;
449 virtual qreal getImplicitHeight() const;
450 virtual void implicitWidthChanged();
451 virtual void implicitHeightChanged();
453 void resolveLayoutMirror();
454 void setImplicitLayoutMirror(bool mirror, bool inherit);
455 void setLayoutMirror(bool mirror);
456 bool isMirrored() const {
457 return effectiveLayoutMirror;
460 void emitChildrenRectChanged(const QRectF &rect) {
462 emit q->childrenRectChanged(rect);
465 QPointF computeTransformOrigin() const;
466 QList<QQuickTransform *> transforms;
467 virtual void transformChanged();
469 QQuickItemKeyFilter *keyHandler;
470 void deliverKeyEvent(QKeyEvent *);
471 void deliverInputMethodEvent(QInputMethodEvent *);
472 void deliverFocusEvent(QFocusEvent *);
473 void deliverMouseEvent(QMouseEvent *);
474 void deliverWheelEvent(QWheelEvent *);
475 void deliverTouchEvent(QTouchEvent *);
476 void deliverHoverEvent(QHoverEvent *);
477 void deliverDragEvent(QEvent *);
479 bool calcEffectiveVisible() const;
480 bool setEffectiveVisibleRecur(bool);
481 bool calcEffectiveEnable() const;
482 void setEffectiveEnableRecur(QQuickItem *scope, bool);
486 TransformOrigin = 0x00000001,
487 Transform = 0x00000002,
488 BasicTransform = 0x00000004,
489 Position = 0x00000008,
493 Content = 0x00000040,
495 OpacityValue = 0x00000100,
496 ChildrenChanged = 0x00000200,
497 ChildrenStackingChanged = 0x00000400,
498 ParentChanged = 0x00000800,
503 EffectReference = 0x00008000,
504 Visible = 0x00010000,
505 HideReference = 0x00020000,
506 PerformanceHints = 0x00040000,
507 // When you add an attribute here, don't forget to update
510 TransformUpdateMask = TransformOrigin | Transform | BasicTransform | Position | Size | Canvas,
511 ComplexTransformUpdateMask = Transform | Canvas,
512 ContentUpdateMask = Size | Content | Smooth | Canvas,
513 ChildrenUpdateMask = ChildrenChanged | ChildrenStackingChanged | EffectReference | Canvas
516 quint32 dirtyAttributes;
517 QString dirtyToString() const;
518 void dirty(DirtyType);
519 void addToDirtyList();
520 void removeFromDirtyList();
521 QQuickItem *nextDirtyItem;
522 QQuickItem**prevDirtyItem;
524 inline QSGTransformNode *itemNode();
525 inline QSGNode *childContainerNode();
536 QSGTransformNode *itemNodeInstance;
537 QSGOpacityNode *opacityNode;
538 QQuickDefaultClipNode *clipNode;
539 QSGRootNode *rootNode;
542 QSGNode *beforePaintNode;
544 virtual QSGTransformNode *createTransformNode();
546 // A reference from an effect item means that this item is used by the effect, so
547 // it should insert a root node.
548 void refFromEffectItem(bool hide);
549 void derefFromEffectItem(bool unhide);
553 void itemChange(QQuickItem::ItemChange, const QQuickItem::ItemChangeData &);
555 virtual void mirrorChange() {}
557 QQuickScreenAttached *screenAttached;
559 mutable QQuickItemLayer *_layer;
561 static qint64 consistentTime;
562 static void setConsistentTime(qint64 t);
563 static void start(QElapsedTimer &);
564 static qint64 elapsed(QElapsedTimer &);
565 static qint64 restart(QElapsedTimer &);
569 Key filters can be installed on a QQuickItem, but not removed. Currently they
570 are only used by attached objects (which are only destroyed on Item
571 destruction), so this isn't a problem. If in future this becomes any form
572 of public API, they will have to support removal too.
574 class QQuickItemKeyFilter
577 QQuickItemKeyFilter(QQuickItem * = 0);
578 virtual ~QQuickItemKeyFilter();
580 virtual void keyPressed(QKeyEvent *event, bool post);
581 virtual void keyReleased(QKeyEvent *event, bool post);
582 virtual void inputMethodEvent(QInputMethodEvent *event, bool post);
583 virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
584 virtual void componentComplete();
589 QQuickItemKeyFilter *m_next;
592 class QQuickKeyNavigationAttachedPrivate : public QObjectPrivate
595 QQuickKeyNavigationAttachedPrivate()
597 left(0), right(0), up(0), down(0), tab(0), backtab(0),
598 leftSet(false), rightSet(false), upSet(false), downSet(false),
599 tabSet(false), backtabSet(false) {}
615 class QQuickKeyNavigationAttached : public QObject, public QQuickItemKeyFilter
618 Q_DECLARE_PRIVATE(QQuickKeyNavigationAttached)
620 Q_PROPERTY(QQuickItem *left READ left WRITE setLeft NOTIFY leftChanged)
621 Q_PROPERTY(QQuickItem *right READ right WRITE setRight NOTIFY rightChanged)
622 Q_PROPERTY(QQuickItem *up READ up WRITE setUp NOTIFY upChanged)
623 Q_PROPERTY(QQuickItem *down READ down WRITE setDown NOTIFY downChanged)
624 Q_PROPERTY(QQuickItem *tab READ tab WRITE setTab NOTIFY tabChanged)
625 Q_PROPERTY(QQuickItem *backtab READ backtab WRITE setBacktab NOTIFY backtabChanged)
626 Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged)
631 QQuickKeyNavigationAttached(QObject * = 0);
633 QQuickItem *left() const;
634 void setLeft(QQuickItem *);
635 QQuickItem *right() const;
636 void setRight(QQuickItem *);
637 QQuickItem *up() const;
638 void setUp(QQuickItem *);
639 QQuickItem *down() const;
640 void setDown(QQuickItem *);
641 QQuickItem *tab() const;
642 void setTab(QQuickItem *);
643 QQuickItem *backtab() const;
644 void setBacktab(QQuickItem *);
646 enum Priority { BeforeItem, AfterItem };
647 Priority priority() const;
648 void setPriority(Priority);
650 static QQuickKeyNavigationAttached *qmlAttachedProperties(QObject *);
658 void backtabChanged();
659 void priorityChanged();
662 virtual void keyPressed(QKeyEvent *event, bool post);
663 virtual void keyReleased(QKeyEvent *event, bool post);
664 void setFocusNavigation(QQuickItem *currentItem, const char *dir);
667 class QQuickLayoutMirroringAttached : public QObject
670 Q_PROPERTY(bool enabled READ enabled WRITE setEnabled RESET resetEnabled NOTIFY enabledChanged)
671 Q_PROPERTY(bool childrenInherit READ childrenInherit WRITE setChildrenInherit NOTIFY childrenInheritChanged)
674 explicit QQuickLayoutMirroringAttached(QObject *parent = 0);
676 bool enabled() const;
677 void setEnabled(bool);
680 bool childrenInherit() const;
681 void setChildrenInherit(bool);
683 static QQuickLayoutMirroringAttached *qmlAttachedProperties(QObject *);
685 void enabledChanged();
686 void childrenInheritChanged();
688 friend class QQuickItemPrivate;
689 QQuickItemPrivate *itemPrivate;
692 class QQuickKeysAttachedPrivate : public QObjectPrivate
695 QQuickKeysAttachedPrivate()
696 : QObjectPrivate(), inPress(false), inRelease(false)
697 , inIM(false), enabled(true), imeItem(0), item(0)
700 bool isConnected(const char *signalName);
710 QList<QQuickItem *> targets;
714 class QQuickKeysAttached : public QObject, public QQuickItemKeyFilter
717 Q_DECLARE_PRIVATE(QQuickKeysAttached)
719 Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
720 Q_PROPERTY(QDeclarativeListProperty<QQuickItem> forwardTo READ forwardTo)
721 Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged)
726 QQuickKeysAttached(QObject *parent=0);
727 ~QQuickKeysAttached();
729 bool enabled() const { Q_D(const QQuickKeysAttached); return d->enabled; }
730 void setEnabled(bool enabled) {
731 Q_D(QQuickKeysAttached);
732 if (enabled != d->enabled) {
733 d->enabled = enabled;
734 emit enabledChanged();
738 enum Priority { BeforeItem, AfterItem};
739 Priority priority() const;
740 void setPriority(Priority);
742 QDeclarativeListProperty<QQuickItem> forwardTo() {
743 Q_D(QQuickKeysAttached);
744 return QDeclarativeListProperty<QQuickItem>(this, d->targets);
747 virtual void componentComplete();
749 static QQuickKeysAttached *qmlAttachedProperties(QObject *);
752 void enabledChanged();
753 void priorityChanged();
754 void pressed(QQuickKeyEvent *event);
755 void released(QQuickKeyEvent *event);
756 void digit0Pressed(QQuickKeyEvent *event);
757 void digit1Pressed(QQuickKeyEvent *event);
758 void digit2Pressed(QQuickKeyEvent *event);
759 void digit3Pressed(QQuickKeyEvent *event);
760 void digit4Pressed(QQuickKeyEvent *event);
761 void digit5Pressed(QQuickKeyEvent *event);
762 void digit6Pressed(QQuickKeyEvent *event);
763 void digit7Pressed(QQuickKeyEvent *event);
764 void digit8Pressed(QQuickKeyEvent *event);
765 void digit9Pressed(QQuickKeyEvent *event);
767 void leftPressed(QQuickKeyEvent *event);
768 void rightPressed(QQuickKeyEvent *event);
769 void upPressed(QQuickKeyEvent *event);
770 void downPressed(QQuickKeyEvent *event);
771 void tabPressed(QQuickKeyEvent *event);
772 void backtabPressed(QQuickKeyEvent *event);
774 void asteriskPressed(QQuickKeyEvent *event);
775 void numberSignPressed(QQuickKeyEvent *event);
776 void escapePressed(QQuickKeyEvent *event);
777 void returnPressed(QQuickKeyEvent *event);
778 void enterPressed(QQuickKeyEvent *event);
779 void deletePressed(QQuickKeyEvent *event);
780 void spacePressed(QQuickKeyEvent *event);
781 void backPressed(QQuickKeyEvent *event);
782 void cancelPressed(QQuickKeyEvent *event);
783 void selectPressed(QQuickKeyEvent *event);
784 void yesPressed(QQuickKeyEvent *event);
785 void noPressed(QQuickKeyEvent *event);
786 void context1Pressed(QQuickKeyEvent *event);
787 void context2Pressed(QQuickKeyEvent *event);
788 void context3Pressed(QQuickKeyEvent *event);
789 void context4Pressed(QQuickKeyEvent *event);
790 void callPressed(QQuickKeyEvent *event);
791 void hangupPressed(QQuickKeyEvent *event);
792 void flipPressed(QQuickKeyEvent *event);
793 void menuPressed(QQuickKeyEvent *event);
794 void volumeUpPressed(QQuickKeyEvent *event);
795 void volumeDownPressed(QQuickKeyEvent *event);
798 virtual void keyPressed(QKeyEvent *event, bool post);
799 virtual void keyReleased(QKeyEvent *event, bool post);
800 virtual void inputMethodEvent(QInputMethodEvent *, bool post);
801 virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
803 const QByteArray keyToSignal(int key) {
804 QByteArray keySignal;
805 if (key >= Qt::Key_0 && key <= Qt::Key_9) {
806 keySignal = "digit0Pressed";
807 keySignal[5] = '0' + (key - Qt::Key_0);
810 while (sigMap[i].key && sigMap[i].key != key)
812 keySignal = sigMap[i].sig;
822 static const SigMap sigMap[];
825 QSGTransformNode *QQuickItemPrivate::itemNode()
827 if (!itemNodeInstance) {
828 itemNodeInstance = createTransformNode();
829 itemNodeInstance->setFlag(QSGNode::OwnedByParent, false);
830 #ifdef QML_RUNTIME_TESTING
832 itemNodeInstance->description = QString::fromLatin1("QQuickItem(%1)").arg(QString::fromLatin1(q->metaObject()->className()));
835 return itemNodeInstance;
838 QSGNode *QQuickItemPrivate::childContainerNode()
841 groupNode = new QSGNode();
843 rootNode->appendChildNode(groupNode);
845 clipNode->appendChildNode(groupNode);
846 else if (opacityNode)
847 opacityNode->appendChildNode(groupNode);
849 itemNode()->appendChildNode(groupNode);
850 groupNode->setFlag(QSGNode::ChildrenDoNotOverlap, childrenDoNotOverlap);
851 groupNode->setFlag(QSGNode::StaticSubtreeGeometry, staticSubtreeGeometry);
852 #ifdef QML_RUNTIME_TESTING
853 groupNode->description = QLatin1String("group");
859 Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickItemPrivate::ChangeTypes);
863 QML_DECLARE_TYPE(QQuickItemLayer)
864 QML_DECLARE_TYPE(QQuickKeysAttached)
865 QML_DECLARE_TYPEINFO(QQuickKeysAttached, QML_HAS_ATTACHED_PROPERTIES)
866 QML_DECLARE_TYPE(QQuickKeyNavigationAttached)
867 QML_DECLARE_TYPEINFO(QQuickKeyNavigationAttached, QML_HAS_ATTACHED_PROPERTIES)
868 QML_DECLARE_TYPE(QQuickLayoutMirroringAttached)
869 QML_DECLARE_TYPEINFO(QQuickLayoutMirroringAttached, QML_HAS_ATTACHED_PROPERTIES)
871 #endif // QQUICKITEM_P_H