1 // Commit: 5c783d0a9a912816813945387903857a314040b5
2 /****************************************************************************
4 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
5 ** All rights reserved.
6 ** Contact: http://www.qt-project.org/
8 ** This file is part of the QtDeclarative module of the Qt Toolkit.
10 ** $QT_BEGIN_LICENSE:LGPL$
11 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this
15 ** file. Please review the following information to ensure the GNU Lesser
16 ** General Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
23 ** GNU General Public License Usage
24 ** Alternatively, this file may be used under the terms of the GNU General
25 ** Public License version 3.0 as published by the Free Software Foundation
26 ** and appearing in the file LICENSE.GPL included in the packaging of this
27 ** file. Please review the following information to ensure the GNU General
28 ** Public License version 3.0 requirements will be met:
29 ** http://www.gnu.org/copyleft/gpl.html.
32 ** Alternatively, this file may be used in accordance with the terms and
33 ** 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(QString 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_effectSource != 0; }
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 QString name() const { return m_name; }
182 void setName(const QString &name) {
186 emit nameChanged(name);
189 QDeclarativeComponent *effect() const { return m_effectComponent; }
190 void setEffect(QDeclarativeComponent *effect);
192 QQuickShaderEffectSource *effectSource() const { return m_effectSource; }
194 void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &);
195 void itemOpacityChanged(QQuickItem *);
196 void itemParentChanged(QQuickItem *, QQuickItem *);
197 void itemSiblingOrderChanged(QQuickItem *);
198 void itemVisibilityChanged(QQuickItem *);
201 void updateGeometry();
202 void updateOpacity();
206 void enabledChanged(bool enabled);
207 void sizeChanged(const QSize &size);
208 void mipmapChanged(bool mipmap);
209 void wrapModeChanged(QQuickShaderEffectSource::WrapMode mode);
210 void nameChanged(const QString &name);
211 void effectChanged(QDeclarativeComponent *component);
212 void smoothChanged(bool smooth);
213 void formatChanged(QQuickShaderEffectSource::Format format);
214 void sourceRectChanged(const QRectF &sourceRect);
224 bool m_componentComplete;
225 QQuickShaderEffectSource::WrapMode m_wrapMode;
226 QQuickShaderEffectSource::Format m_format;
230 QDeclarativeComponent *m_effectComponent;
231 QQuickShaderEffect *m_effect;
232 QQuickShaderEffectSource *m_effectSource;
235 class Q_QUICK_EXPORT QQuickItemPrivate : public QObjectPrivate
237 Q_DECLARE_PUBLIC(QQuickItem)
240 static QQuickItemPrivate* get(QQuickItem *item) { return item->d_func(); }
241 static const QQuickItemPrivate* get(const QQuickItem *item) { return item->d_func(); }
243 static void registerAccessorProperties();
246 ~QQuickItemPrivate();
247 void init(QQuickItem *parent);
249 QDeclarativeListProperty<QObject> data();
250 QDeclarativeListProperty<QObject> resources();
251 QDeclarativeListProperty<QQuickItem> children();
253 QDeclarativeListProperty<QDeclarativeState> states();
254 QDeclarativeListProperty<QDeclarativeTransition> transitions();
256 QString state() const;
257 void setState(const QString &);
259 QQuickAnchorLine left() const;
260 QQuickAnchorLine right() const;
261 QQuickAnchorLine horizontalCenter() const;
262 QQuickAnchorLine top() const;
263 QQuickAnchorLine bottom() const;
264 QQuickAnchorLine verticalCenter() const;
265 QQuickAnchorLine baseline() const;
267 QQuickItemLayer *layer() const;
270 static void data_append(QDeclarativeListProperty<QObject> *, QObject *);
271 static int data_count(QDeclarativeListProperty<QObject> *);
272 static QObject *data_at(QDeclarativeListProperty<QObject> *, int);
273 static void data_clear(QDeclarativeListProperty<QObject> *);
275 // resources property
276 static QObject *resources_at(QDeclarativeListProperty<QObject> *, int);
277 static void resources_append(QDeclarativeListProperty<QObject> *, QObject *);
278 static int resources_count(QDeclarativeListProperty<QObject> *);
279 static void resources_clear(QDeclarativeListProperty<QObject> *);
282 static void children_append(QDeclarativeListProperty<QQuickItem> *, QQuickItem *);
283 static int children_count(QDeclarativeListProperty<QQuickItem> *);
284 static QQuickItem *children_at(QDeclarativeListProperty<QQuickItem> *, int);
285 static void children_clear(QDeclarativeListProperty<QQuickItem> *);
287 // transform property
288 static int transform_count(QDeclarativeListProperty<QQuickTransform> *list);
289 static void transform_append(QDeclarativeListProperty<QQuickTransform> *list, QQuickTransform *);
290 static QQuickTransform *transform_at(QDeclarativeListProperty<QQuickTransform> *list, int);
291 static void transform_clear(QDeclarativeListProperty<QQuickTransform> *list);
293 QQuickAnchors *anchors() const;
294 mutable QQuickAnchors *_anchors;
295 QQuickContents *_contents;
297 QDeclarativeNullableValue<qreal> baselineOffset;
300 AnchorLines(QQuickItem *);
301 QQuickAnchorLine left;
302 QQuickAnchorLine right;
303 QQuickAnchorLine hCenter;
304 QQuickAnchorLine top;
305 QQuickAnchorLine bottom;
306 QQuickAnchorLine vCenter;
307 QQuickAnchorLine baseline;
309 mutable AnchorLines *_anchorLines;
310 AnchorLines *anchorLines() const;
323 Q_DECLARE_FLAGS(ChangeTypes, ChangeType)
325 enum GeometryChangeType {
331 SizeChange = WidthChange | HeightChange,
332 GeometryChange = XChange | YChange | SizeChange
335 Q_DECLARE_FLAGS(GeometryChangeTypes, GeometryChangeType)
337 struct ChangeListener {
338 ChangeListener(QQuickItemChangeListener *l, QQuickItemPrivate::ChangeTypes t) : listener(l), types(t), gTypes(GeometryChange) {}
339 ChangeListener(QQuickItemChangeListener *l, QQuickItemPrivate::GeometryChangeTypes gt) : listener(l), types(Geometry), gTypes(gt) {}
340 QQuickItemChangeListener *listener;
341 QQuickItemPrivate::ChangeTypes types;
342 QQuickItemPrivate::GeometryChangeTypes gTypes; //NOTE: not used for ==
343 bool operator==(const ChangeListener &other) const { return listener == other.listener && types == other.types; }
346 void addItemChangeListener(QQuickItemChangeListener *listener, ChangeTypes types) {
347 changeListeners.append(ChangeListener(listener, types));
349 void removeItemChangeListener(QQuickItemChangeListener *, ChangeTypes types);
350 void updateOrAddGeometryChangeListener(QQuickItemChangeListener *listener, GeometryChangeTypes types);
351 void updateOrRemoveGeometryChangeListener(QQuickItemChangeListener *listener, GeometryChangeTypes types);
352 QPODVector<ChangeListener,4> changeListeners;
354 QDeclarativeStateGroup *_states();
355 QDeclarativeStateGroup *_stateGroup;
357 QQuickItem::TransformOrigin origin:5;
361 bool componentComplete:1;
368 bool notifiedFocus:1;
369 bool notifiedActiveFocus:1;
370 bool filtersChildMouseEvents:1;
371 bool explicitVisible:1;
372 bool effectiveVisible:1;
373 bool explicitEnable:1;
374 bool effectiveEnable:1;
375 bool polishScheduled:1;
376 bool inheritedLayoutMirror:1;
377 bool effectiveLayoutMirror:1;
378 bool isMirrorImplicit:1;
379 bool inheritMirrorFromParent:1;
380 bool inheritMirrorFromItem:1;
381 bool childrenDoNotOverlap:1;
382 bool staticSubtreeGeometry:1;
385 QQuickCanvas *canvas;
386 QSGContext *sceneGraphContext() const { Q_ASSERT(canvas); return static_cast<QQuickCanvasPrivate *>(QObjectPrivate::get(canvas))->context; }
388 QQuickItem *parentItem;
389 QDeclarativeNotifier parentNotifier;
391 QList<QQuickItem *> childItems;
392 mutable QList<QQuickItem *> *sortedChildItems;
393 QList<QQuickItem *> paintOrderChildItems() const;
394 void addChild(QQuickItem *);
395 void removeChild(QQuickItem *);
396 void siblingOrderChanged();
398 inline void markSortedChildrenDirty(QQuickItem *child) {
399 // If sortedChildItems == &childItems then all in childItems have z == 0
400 // and we don't need to invalidate if the changed item also has z == 0.
401 if (child->z() != 0. || sortedChildItems != &childItems) {
402 if (sortedChildItems != &childItems)
403 delete sortedChildItems;
404 sortedChildItems = 0;
408 class InitializationState {
410 QQuickItem *getFocusScope(QQuickItem *item);
412 void clear(QQuickItem *focusScope);
414 QQuickItem *focusScope;
416 void initCanvas(InitializationState *, QQuickCanvas *);
418 QQuickItem *subFocusItem;
420 QTransform canvasToItemTransform() const;
421 QTransform itemToCanvasTransform() const;
422 void itemToParentTransform(QTransform &) const;
429 qreal implicitHeight;
436 QQuickLayoutMirroringAttached* attachedLayoutDirection;
438 Qt::MouseButtons acceptedMouseButtons;
439 Qt::InputMethodHints imHints;
441 void setAccessibleFlagAndListener();
443 QPointF transformOriginPoint;
445 virtual qreal getImplicitWidth() const;
446 virtual qreal getImplicitHeight() const;
447 virtual void implicitWidthChanged();
448 virtual void implicitHeightChanged();
450 void resolveLayoutMirror();
451 void setImplicitLayoutMirror(bool mirror, bool inherit);
452 void setLayoutMirror(bool mirror);
453 bool isMirrored() const {
454 return effectiveLayoutMirror;
457 void emitChildrenRectChanged(const QRectF &rect) {
459 emit q->childrenRectChanged(rect);
462 QPointF computeTransformOrigin() const;
463 QList<QQuickTransform *> transforms;
464 virtual void transformChanged();
466 QQuickItemKeyFilter *keyHandler;
467 void deliverKeyEvent(QKeyEvent *);
468 void deliverInputMethodEvent(QInputMethodEvent *);
469 void deliverFocusEvent(QFocusEvent *);
470 void deliverMouseEvent(QMouseEvent *);
471 void deliverWheelEvent(QWheelEvent *);
472 void deliverTouchEvent(QTouchEvent *);
473 void deliverHoverEvent(QHoverEvent *);
474 void deliverDragEvent(QEvent *);
476 bool calcEffectiveVisible() const;
477 void setEffectiveVisibleRecur(bool);
478 bool calcEffectiveEnable() const;
479 void setEffectiveEnableRecur(bool);
483 TransformOrigin = 0x00000001,
484 Transform = 0x00000002,
485 BasicTransform = 0x00000004,
486 Position = 0x00000008,
490 Content = 0x00000040,
492 OpacityValue = 0x00000100,
493 ChildrenChanged = 0x00000200,
494 ChildrenStackingChanged = 0x00000400,
495 ParentChanged = 0x00000800,
500 EffectReference = 0x00008000,
501 Visible = 0x00010000,
502 HideReference = 0x00020000,
503 PerformanceHints = 0x00040000,
504 // When you add an attribute here, don't forget to update
507 TransformUpdateMask = TransformOrigin | Transform | BasicTransform | Position | Size | Canvas,
508 ComplexTransformUpdateMask = Transform | Canvas,
509 ContentUpdateMask = Size | Content | Smooth | Canvas,
510 ChildrenUpdateMask = ChildrenChanged | ChildrenStackingChanged | EffectReference | Canvas
513 quint32 dirtyAttributes;
514 QString dirtyToString() const;
515 void dirty(DirtyType);
516 void addToDirtyList();
517 void removeFromDirtyList();
518 QQuickItem *nextDirtyItem;
519 QQuickItem**prevDirtyItem;
521 inline QSGTransformNode *itemNode();
522 inline QSGNode *childContainerNode();
533 QSGTransformNode *itemNodeInstance;
534 QSGOpacityNode *opacityNode;
535 QQuickDefaultClipNode *clipNode;
536 QSGRootNode *rootNode;
539 QSGNode *beforePaintNode;
541 virtual QSGTransformNode *createTransformNode();
543 // A reference from an effect item means that this item is used by the effect, so
544 // it should insert a root node.
545 void refFromEffectItem(bool hide);
546 void derefFromEffectItem(bool unhide);
550 void itemChange(QQuickItem::ItemChange, const QQuickItem::ItemChangeData &);
552 virtual void mirrorChange() {}
554 QQuickScreenAttached *screenAttached;
556 mutable QQuickItemLayer *_layer;
558 static qint64 consistentTime;
559 static void setConsistentTime(qint64 t);
560 static void start(QElapsedTimer &);
561 static qint64 elapsed(QElapsedTimer &);
562 static qint64 restart(QElapsedTimer &);
566 Key filters can be installed on a QQuickItem, but not removed. Currently they
567 are only used by attached objects (which are only destroyed on Item
568 destruction), so this isn't a problem. If in future this becomes any form
569 of public API, they will have to support removal too.
571 class QQuickItemKeyFilter
574 QQuickItemKeyFilter(QQuickItem * = 0);
575 virtual ~QQuickItemKeyFilter();
577 virtual void keyPressed(QKeyEvent *event, bool post);
578 virtual void keyReleased(QKeyEvent *event, bool post);
579 virtual void inputMethodEvent(QInputMethodEvent *event, bool post);
580 virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
581 virtual void componentComplete();
586 QQuickItemKeyFilter *m_next;
589 class QQuickKeyNavigationAttachedPrivate : public QObjectPrivate
592 QQuickKeyNavigationAttachedPrivate()
594 left(0), right(0), up(0), down(0), tab(0), backtab(0),
595 leftSet(false), rightSet(false), upSet(false), downSet(false),
596 tabSet(false), backtabSet(false) {}
612 class QQuickKeyNavigationAttached : public QObject, public QQuickItemKeyFilter
615 Q_DECLARE_PRIVATE(QQuickKeyNavigationAttached)
617 Q_PROPERTY(QQuickItem *left READ left WRITE setLeft NOTIFY leftChanged)
618 Q_PROPERTY(QQuickItem *right READ right WRITE setRight NOTIFY rightChanged)
619 Q_PROPERTY(QQuickItem *up READ up WRITE setUp NOTIFY upChanged)
620 Q_PROPERTY(QQuickItem *down READ down WRITE setDown NOTIFY downChanged)
621 Q_PROPERTY(QQuickItem *tab READ tab WRITE setTab NOTIFY tabChanged)
622 Q_PROPERTY(QQuickItem *backtab READ backtab WRITE setBacktab NOTIFY backtabChanged)
623 Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged)
628 QQuickKeyNavigationAttached(QObject * = 0);
630 QQuickItem *left() const;
631 void setLeft(QQuickItem *);
632 QQuickItem *right() const;
633 void setRight(QQuickItem *);
634 QQuickItem *up() const;
635 void setUp(QQuickItem *);
636 QQuickItem *down() const;
637 void setDown(QQuickItem *);
638 QQuickItem *tab() const;
639 void setTab(QQuickItem *);
640 QQuickItem *backtab() const;
641 void setBacktab(QQuickItem *);
643 enum Priority { BeforeItem, AfterItem };
644 Priority priority() const;
645 void setPriority(Priority);
647 static QQuickKeyNavigationAttached *qmlAttachedProperties(QObject *);
655 void backtabChanged();
656 void priorityChanged();
659 virtual void keyPressed(QKeyEvent *event, bool post);
660 virtual void keyReleased(QKeyEvent *event, bool post);
661 void setFocusNavigation(QQuickItem *currentItem, const char *dir);
664 class QQuickLayoutMirroringAttached : public QObject
667 Q_PROPERTY(bool enabled READ enabled WRITE setEnabled RESET resetEnabled NOTIFY enabledChanged)
668 Q_PROPERTY(bool childrenInherit READ childrenInherit WRITE setChildrenInherit NOTIFY childrenInheritChanged)
671 explicit QQuickLayoutMirroringAttached(QObject *parent = 0);
673 bool enabled() const;
674 void setEnabled(bool);
677 bool childrenInherit() const;
678 void setChildrenInherit(bool);
680 static QQuickLayoutMirroringAttached *qmlAttachedProperties(QObject *);
682 void enabledChanged();
683 void childrenInheritChanged();
685 friend class QQuickItemPrivate;
686 QQuickItemPrivate *itemPrivate;
689 class QQuickKeysAttachedPrivate : public QObjectPrivate
692 QQuickKeysAttachedPrivate()
693 : QObjectPrivate(), inPress(false), inRelease(false)
694 , inIM(false), enabled(true), imeItem(0), item(0)
697 bool isConnected(const char *signalName);
707 QList<QQuickItem *> targets;
711 class QQuickKeysAttached : public QObject, public QQuickItemKeyFilter
714 Q_DECLARE_PRIVATE(QQuickKeysAttached)
716 Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
717 Q_PROPERTY(QDeclarativeListProperty<QQuickItem> forwardTo READ forwardTo)
718 Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged)
723 QQuickKeysAttached(QObject *parent=0);
724 ~QQuickKeysAttached();
726 bool enabled() const { Q_D(const QQuickKeysAttached); return d->enabled; }
727 void setEnabled(bool enabled) {
728 Q_D(QQuickKeysAttached);
729 if (enabled != d->enabled) {
730 d->enabled = enabled;
731 emit enabledChanged();
735 enum Priority { BeforeItem, AfterItem};
736 Priority priority() const;
737 void setPriority(Priority);
739 QDeclarativeListProperty<QQuickItem> forwardTo() {
740 Q_D(QQuickKeysAttached);
741 return QDeclarativeListProperty<QQuickItem>(this, d->targets);
744 virtual void componentComplete();
746 static QQuickKeysAttached *qmlAttachedProperties(QObject *);
749 void enabledChanged();
750 void priorityChanged();
751 void pressed(QQuickKeyEvent *event);
752 void released(QQuickKeyEvent *event);
753 void digit0Pressed(QQuickKeyEvent *event);
754 void digit1Pressed(QQuickKeyEvent *event);
755 void digit2Pressed(QQuickKeyEvent *event);
756 void digit3Pressed(QQuickKeyEvent *event);
757 void digit4Pressed(QQuickKeyEvent *event);
758 void digit5Pressed(QQuickKeyEvent *event);
759 void digit6Pressed(QQuickKeyEvent *event);
760 void digit7Pressed(QQuickKeyEvent *event);
761 void digit8Pressed(QQuickKeyEvent *event);
762 void digit9Pressed(QQuickKeyEvent *event);
764 void leftPressed(QQuickKeyEvent *event);
765 void rightPressed(QQuickKeyEvent *event);
766 void upPressed(QQuickKeyEvent *event);
767 void downPressed(QQuickKeyEvent *event);
768 void tabPressed(QQuickKeyEvent *event);
769 void backtabPressed(QQuickKeyEvent *event);
771 void asteriskPressed(QQuickKeyEvent *event);
772 void numberSignPressed(QQuickKeyEvent *event);
773 void escapePressed(QQuickKeyEvent *event);
774 void returnPressed(QQuickKeyEvent *event);
775 void enterPressed(QQuickKeyEvent *event);
776 void deletePressed(QQuickKeyEvent *event);
777 void spacePressed(QQuickKeyEvent *event);
778 void backPressed(QQuickKeyEvent *event);
779 void cancelPressed(QQuickKeyEvent *event);
780 void selectPressed(QQuickKeyEvent *event);
781 void yesPressed(QQuickKeyEvent *event);
782 void noPressed(QQuickKeyEvent *event);
783 void context1Pressed(QQuickKeyEvent *event);
784 void context2Pressed(QQuickKeyEvent *event);
785 void context3Pressed(QQuickKeyEvent *event);
786 void context4Pressed(QQuickKeyEvent *event);
787 void callPressed(QQuickKeyEvent *event);
788 void hangupPressed(QQuickKeyEvent *event);
789 void flipPressed(QQuickKeyEvent *event);
790 void menuPressed(QQuickKeyEvent *event);
791 void volumeUpPressed(QQuickKeyEvent *event);
792 void volumeDownPressed(QQuickKeyEvent *event);
795 virtual void keyPressed(QKeyEvent *event, bool post);
796 virtual void keyReleased(QKeyEvent *event, bool post);
797 virtual void inputMethodEvent(QInputMethodEvent *, bool post);
798 virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
800 const QByteArray keyToSignal(int key) {
801 QByteArray keySignal;
802 if (key >= Qt::Key_0 && key <= Qt::Key_9) {
803 keySignal = "digit0Pressed";
804 keySignal[5] = '0' + (key - Qt::Key_0);
807 while (sigMap[i].key && sigMap[i].key != key)
809 keySignal = sigMap[i].sig;
819 static const SigMap sigMap[];
822 QSGTransformNode *QQuickItemPrivate::itemNode()
824 if (!itemNodeInstance) {
825 itemNodeInstance = createTransformNode();
826 itemNodeInstance->setFlag(QSGNode::OwnedByParent, false);
827 #ifdef QML_RUNTIME_TESTING
829 itemNodeInstance->description = QString::fromLatin1("QQuickItem(%1)").arg(QString::fromLatin1(q->metaObject()->className()));
832 return itemNodeInstance;
835 QSGNode *QQuickItemPrivate::childContainerNode()
838 groupNode = new QSGNode();
840 rootNode->appendChildNode(groupNode);
842 clipNode->appendChildNode(groupNode);
843 else if (opacityNode)
844 opacityNode->appendChildNode(groupNode);
846 itemNode()->appendChildNode(groupNode);
847 groupNode->setFlag(QSGNode::ChildrenDoNotOverlap, childrenDoNotOverlap);
848 groupNode->setFlag(QSGNode::StaticSubtreeGeometry, staticSubtreeGeometry);
849 #ifdef QML_RUNTIME_TESTING
850 groupNode->description = QLatin1String("group");
856 Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickItemPrivate::ChangeTypes);
860 QML_DECLARE_TYPE(QQuickItemLayer)
861 QML_DECLARE_TYPE(QQuickKeysAttached)
862 QML_DECLARE_TYPEINFO(QQuickKeysAttached, QML_HAS_ATTACHED_PROPERTIES)
863 QML_DECLARE_TYPE(QQuickKeyNavigationAttached)
864 QML_DECLARE_TYPEINFO(QQuickKeyNavigationAttached, QML_HAS_ATTACHED_PROPERTIES)
865 QML_DECLARE_TYPE(QQuickLayoutMirroringAttached)
866 QML_DECLARE_TYPEINFO(QQuickLayoutMirroringAttached, QML_HAS_ATTACHED_PROPERTIES)
868 #endif // QQUICKITEM_P_H