src/declarative/graphicsitems/qdeclarativeitem_p.h
changeset 30 5dc02b23752f
child 33 3e2da88830cd
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the QtDeclarative module of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #ifndef QDECLARATIVEITEM_P_H
       
    43 #define QDECLARATIVEITEM_P_H
       
    44 
       
    45 //
       
    46 //  W A R N I N G
       
    47 //  -------------
       
    48 //
       
    49 // This file is not part of the Qt API.  It exists purely as an
       
    50 // implementation detail.  This header file may change from version to
       
    51 // version without notice, or even be removed.
       
    52 //
       
    53 // We mean it.
       
    54 //
       
    55 
       
    56 #include "qdeclarativeitem.h"
       
    57 
       
    58 #include "private/qdeclarativeanchors_p.h"
       
    59 #include "private/qdeclarativeanchors_p_p.h"
       
    60 #include "private/qdeclarativeitemchangelistener_p.h"
       
    61 #include <private/qpodvector_p.h>
       
    62 
       
    63 #include <private/qdeclarativestate_p.h>
       
    64 #include <private/qdeclarativenullablevalue_p_p.h>
       
    65 #include <private/qdeclarativenotifier_p.h>
       
    66 #include <private/qdeclarativeglobal_p.h>
       
    67 
       
    68 #include <qdeclarative.h>
       
    69 #include <qdeclarativecontext.h>
       
    70 
       
    71 #include <QtCore/qlist.h>
       
    72 #include <QtCore/qdebug.h>
       
    73 
       
    74 #include <private/qgraphicsitem_p.h>
       
    75 
       
    76 QT_BEGIN_NAMESPACE
       
    77 
       
    78 class QNetworkReply;
       
    79 class QDeclarativeItemKeyFilter;
       
    80 
       
    81 //### merge into private?
       
    82 class QDeclarativeContents : public QObject, public QDeclarativeItemChangeListener
       
    83 {
       
    84     Q_OBJECT
       
    85 public:
       
    86     QDeclarativeContents();
       
    87     ~QDeclarativeContents();
       
    88 
       
    89     QRectF rectF() const;
       
    90 
       
    91     void setItem(QDeclarativeItem *item);
       
    92 
       
    93     void childRemoved(QDeclarativeItem *item);
       
    94     void childAdded(QDeclarativeItem *item);
       
    95 
       
    96 Q_SIGNALS:
       
    97     void rectChanged(QRectF);
       
    98 
       
    99 protected:
       
   100     void itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeometry, const QRectF &oldGeometry);
       
   101     void itemDestroyed(QDeclarativeItem *item);
       
   102     //void itemVisibilityChanged(QDeclarativeItem *item)
       
   103 
       
   104 private:
       
   105     void calcHeight(QDeclarativeItem *changed = 0);
       
   106     void calcWidth(QDeclarativeItem *changed = 0);
       
   107 
       
   108     QDeclarativeItem *m_item;
       
   109     qreal m_x;
       
   110     qreal m_y;
       
   111     qreal m_width;
       
   112     qreal m_height;
       
   113 };
       
   114 
       
   115 class Q_DECLARATIVE_EXPORT QDeclarativeItemPrivate : public QGraphicsItemPrivate
       
   116 {
       
   117     Q_DECLARE_PUBLIC(QDeclarativeItem)
       
   118 
       
   119 public:
       
   120     QDeclarativeItemPrivate()
       
   121     : _anchors(0), _contents(0),
       
   122       _baselineOffset(0),
       
   123       _anchorLines(0),
       
   124       _stateGroup(0), origin(QDeclarativeItem::Center),
       
   125       widthValid(false), heightValid(false),
       
   126       _componentComplete(true), _keepMouse(false),
       
   127       smooth(false), transformOriginDirty(true), doneEventPreHandler(false), keyHandler(0),
       
   128       mWidth(0), mHeight(0), implicitWidth(0), implicitHeight(0)
       
   129     {
       
   130         QGraphicsItemPrivate::acceptedMouseButtons = 0;
       
   131         isDeclarativeItem = 1;
       
   132         QGraphicsItemPrivate::flags = QGraphicsItem::GraphicsItemFlags(
       
   133                                       QGraphicsItem::ItemHasNoContents
       
   134                                       | QGraphicsItem::ItemIsFocusable
       
   135                                       | QGraphicsItem::ItemNegativeZStacksBehindParent);
       
   136 
       
   137     }
       
   138 
       
   139     void init(QDeclarativeItem *parent)
       
   140     {
       
   141         Q_Q(QDeclarativeItem);
       
   142         if (parent) {
       
   143             QDeclarative_setParent_noEvent(q, parent);
       
   144             q->setParentItem(parent);
       
   145         }
       
   146         _baselineOffset.invalidate();
       
   147         mouseSetsFocus = false;
       
   148     }
       
   149 
       
   150     QString _id;
       
   151 
       
   152     // Private Properties
       
   153     qreal width() const;
       
   154     void setWidth(qreal);
       
   155     void resetWidth();
       
   156 
       
   157     qreal height() const;
       
   158     void setHeight(qreal);
       
   159     void resetHeight();
       
   160 
       
   161     QDeclarativeListProperty<QObject> data();
       
   162     QDeclarativeListProperty<QObject> resources();
       
   163 
       
   164     QDeclarativeListProperty<QDeclarativeState> states();
       
   165     QDeclarativeListProperty<QDeclarativeTransition> transitions();
       
   166 
       
   167     QString state() const;
       
   168     void setState(const QString &);
       
   169 
       
   170     QDeclarativeAnchorLine left() const;
       
   171     QDeclarativeAnchorLine right() const;
       
   172     QDeclarativeAnchorLine horizontalCenter() const;
       
   173     QDeclarativeAnchorLine top() const;
       
   174     QDeclarativeAnchorLine bottom() const;
       
   175     QDeclarativeAnchorLine verticalCenter() const;
       
   176     QDeclarativeAnchorLine baseline() const;
       
   177 
       
   178     // data property
       
   179     static void data_append(QDeclarativeListProperty<QObject> *, QObject *);
       
   180 
       
   181     // resources property
       
   182     static QObject *resources_at(QDeclarativeListProperty<QObject> *, int);
       
   183     static void resources_append(QDeclarativeListProperty<QObject> *, QObject *);
       
   184     static int resources_count(QDeclarativeListProperty<QObject> *);
       
   185 
       
   186     // transform property
       
   187     static int transform_count(QDeclarativeListProperty<QGraphicsTransform> *list);
       
   188     static void transform_append(QDeclarativeListProperty<QGraphicsTransform> *list, QGraphicsTransform *);
       
   189     static QGraphicsTransform *transform_at(QDeclarativeListProperty<QGraphicsTransform> *list, int);
       
   190     static void transform_clear(QDeclarativeListProperty<QGraphicsTransform> *list);
       
   191 
       
   192     static QDeclarativeItemPrivate* get(QDeclarativeItem *item)
       
   193     {
       
   194         return item->d_func();
       
   195     }
       
   196 
       
   197     // Accelerated property accessors
       
   198     QDeclarativeNotifier parentNotifier;
       
   199     static void parentProperty(QObject *o, void *rv, QDeclarativeNotifierEndpoint *e);
       
   200 
       
   201     QDeclarativeAnchors *anchors() {
       
   202         if (!_anchors) {
       
   203             Q_Q(QDeclarativeItem);
       
   204             _anchors = new QDeclarativeAnchors(q);
       
   205             if (!_componentComplete)
       
   206                 _anchors->classBegin();
       
   207         }
       
   208         return _anchors;
       
   209     }
       
   210     QDeclarativeAnchors *_anchors;
       
   211     QDeclarativeContents *_contents;
       
   212 
       
   213     QDeclarativeNullableValue<qreal> _baselineOffset;
       
   214 
       
   215     struct AnchorLines {
       
   216         AnchorLines(QGraphicsObject *);
       
   217         QDeclarativeAnchorLine left;
       
   218         QDeclarativeAnchorLine right;
       
   219         QDeclarativeAnchorLine hCenter;
       
   220         QDeclarativeAnchorLine top;
       
   221         QDeclarativeAnchorLine bottom;
       
   222         QDeclarativeAnchorLine vCenter;
       
   223         QDeclarativeAnchorLine baseline;
       
   224     };
       
   225     mutable AnchorLines *_anchorLines;
       
   226     AnchorLines *anchorLines() const {
       
   227         Q_Q(const QDeclarativeItem);
       
   228         if (!_anchorLines) _anchorLines =
       
   229             new AnchorLines(const_cast<QDeclarativeItem *>(q));
       
   230         return _anchorLines;
       
   231     }
       
   232 
       
   233     enum ChangeType {
       
   234         Geometry = 0x01,
       
   235         SiblingOrder = 0x02,
       
   236         Visibility = 0x04,
       
   237         Opacity = 0x08,
       
   238         Destroyed = 0x10
       
   239     };
       
   240 
       
   241     Q_DECLARE_FLAGS(ChangeTypes, ChangeType)
       
   242 
       
   243     struct ChangeListener {
       
   244         ChangeListener(QDeclarativeItemChangeListener *l, QDeclarativeItemPrivate::ChangeTypes t) : listener(l), types(t) {}
       
   245         QDeclarativeItemChangeListener *listener;
       
   246         QDeclarativeItemPrivate::ChangeTypes types;
       
   247         bool operator==(const ChangeListener &other) const { return listener == other.listener && types == other.types; }
       
   248     };
       
   249 
       
   250     void addItemChangeListener(QDeclarativeItemChangeListener *listener, ChangeTypes types) {
       
   251         changeListeners.append(ChangeListener(listener, types));
       
   252     }
       
   253     void removeItemChangeListener(QDeclarativeItemChangeListener *, ChangeTypes types);
       
   254     QPODVector<ChangeListener,4> changeListeners;
       
   255 
       
   256     QDeclarativeStateGroup *_states();
       
   257     QDeclarativeStateGroup *_stateGroup;
       
   258 
       
   259     QDeclarativeItem::TransformOrigin origin:4;
       
   260     bool widthValid:1;
       
   261     bool heightValid:1;
       
   262     bool _componentComplete:1;
       
   263     bool _keepMouse:1;
       
   264     bool smooth:1;
       
   265     bool transformOriginDirty : 1;
       
   266     bool doneEventPreHandler : 1;
       
   267 
       
   268     QDeclarativeItemKeyFilter *keyHandler;
       
   269 
       
   270     qreal mWidth;
       
   271     qreal mHeight;
       
   272     qreal implicitWidth;
       
   273     qreal implicitHeight;
       
   274 
       
   275     QPointF computeTransformOrigin() const;
       
   276 
       
   277     virtual void setPosHelper(const QPointF &pos)
       
   278     {
       
   279         Q_Q(QDeclarativeItem);
       
   280         QRectF oldGeometry(this->pos.x(), this->pos.y(), mWidth, mHeight);
       
   281         QGraphicsItemPrivate::setPosHelper(pos);
       
   282         q->geometryChanged(QRectF(this->pos.x(), this->pos.y(), mWidth, mHeight), oldGeometry);
       
   283     }
       
   284 
       
   285     // Reimplemented from QGraphicsItemPrivate
       
   286     virtual void subFocusItemChange()
       
   287     {
       
   288         emit q_func()->wantsFocusChanged(subFocusItem != 0);
       
   289     }
       
   290 
       
   291     // Reimplemented from QGraphicsItemPrivate
       
   292     virtual void siblingOrderChange()
       
   293     {
       
   294         Q_Q(QDeclarativeItem);
       
   295         for(int ii = 0; ii < changeListeners.count(); ++ii) {
       
   296             const QDeclarativeItemPrivate::ChangeListener &change = changeListeners.at(ii);
       
   297             if (change.types & QDeclarativeItemPrivate::SiblingOrder) {
       
   298                 change.listener->itemSiblingOrderChanged(q);
       
   299             }
       
   300         }
       
   301     }
       
   302 
       
   303     // Reimplemented from QGraphicsItemPrivate
       
   304     virtual void transformChanged();
       
   305 
       
   306     virtual void focusChanged(bool);
       
   307 
       
   308     static int consistentTime;
       
   309     static QTime currentTime();
       
   310     static void setConsistentTime(int t);
       
   311     static void start(QTime &);
       
   312     static int elapsed(QTime &);
       
   313     static int restart(QTime &);
       
   314 };
       
   315 
       
   316 /*
       
   317     Key filters can be installed on a QDeclarativeItem, but not removed.  Currently they
       
   318     are only used by attached objects (which are only destroyed on Item
       
   319     destruction), so this isn't a problem.  If in future this becomes any form
       
   320     of public API, they will have to support removal too.
       
   321 */
       
   322 class QDeclarativeItemKeyFilter
       
   323 {
       
   324 public:
       
   325     QDeclarativeItemKeyFilter(QDeclarativeItem * = 0);
       
   326     virtual ~QDeclarativeItemKeyFilter();
       
   327 
       
   328     virtual void keyPressed(QKeyEvent *event, bool post);
       
   329     virtual void keyReleased(QKeyEvent *event, bool post);
       
   330     virtual void inputMethodEvent(QInputMethodEvent *event, bool post);
       
   331     virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
       
   332     virtual void componentComplete();
       
   333 
       
   334     bool m_processPost;
       
   335 
       
   336 private:
       
   337     QDeclarativeItemKeyFilter *m_next;
       
   338 };
       
   339 
       
   340 class QDeclarativeKeyNavigationAttachedPrivate : public QObjectPrivate
       
   341 {
       
   342 public:
       
   343     QDeclarativeKeyNavigationAttachedPrivate()
       
   344         : QObjectPrivate(), left(0), right(0), up(0), down(0), tab(0), backtab(0) {}
       
   345 
       
   346     QDeclarativeItem *left;
       
   347     QDeclarativeItem *right;
       
   348     QDeclarativeItem *up;
       
   349     QDeclarativeItem *down;
       
   350     QDeclarativeItem *tab;
       
   351     QDeclarativeItem *backtab;
       
   352 };
       
   353 
       
   354 class QDeclarativeKeyNavigationAttached : public QObject, public QDeclarativeItemKeyFilter
       
   355 {
       
   356     Q_OBJECT
       
   357     Q_DECLARE_PRIVATE(QDeclarativeKeyNavigationAttached)
       
   358 
       
   359     Q_PROPERTY(QDeclarativeItem *left READ left WRITE setLeft NOTIFY changed)
       
   360     Q_PROPERTY(QDeclarativeItem *right READ right WRITE setRight NOTIFY changed)
       
   361     Q_PROPERTY(QDeclarativeItem *up READ up WRITE setUp NOTIFY changed)
       
   362     Q_PROPERTY(QDeclarativeItem *down READ down WRITE setDown NOTIFY changed)
       
   363     Q_PROPERTY(QDeclarativeItem *tab READ tab WRITE setTab NOTIFY changed)
       
   364     Q_PROPERTY(QDeclarativeItem *backtab READ backtab WRITE setBacktab NOTIFY changed)
       
   365     Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged)
       
   366 
       
   367     Q_ENUMS(Priority)
       
   368 
       
   369 public:
       
   370     QDeclarativeKeyNavigationAttached(QObject * = 0);
       
   371 
       
   372     QDeclarativeItem *left() const;
       
   373     void setLeft(QDeclarativeItem *);
       
   374     QDeclarativeItem *right() const;
       
   375     void setRight(QDeclarativeItem *);
       
   376     QDeclarativeItem *up() const;
       
   377     void setUp(QDeclarativeItem *);
       
   378     QDeclarativeItem *down() const;
       
   379     void setDown(QDeclarativeItem *);
       
   380     QDeclarativeItem *tab() const;
       
   381     void setTab(QDeclarativeItem *);
       
   382     QDeclarativeItem *backtab() const;
       
   383     void setBacktab(QDeclarativeItem *);
       
   384 
       
   385     enum Priority { BeforeItem, AfterItem };
       
   386     Priority priority() const;
       
   387     void setPriority(Priority);
       
   388 
       
   389     static QDeclarativeKeyNavigationAttached *qmlAttachedProperties(QObject *);
       
   390 
       
   391 Q_SIGNALS:
       
   392     void changed();
       
   393     void priorityChanged();
       
   394 
       
   395 private:
       
   396     virtual void keyPressed(QKeyEvent *event, bool post);
       
   397     virtual void keyReleased(QKeyEvent *event, bool post);
       
   398 };
       
   399 
       
   400 class QDeclarativeKeysAttachedPrivate : public QObjectPrivate
       
   401 {
       
   402 public:
       
   403     QDeclarativeKeysAttachedPrivate()
       
   404         : QObjectPrivate(), inPress(false), inRelease(false)
       
   405         , inIM(false), enabled(true), imeItem(0), item(0)
       
   406     {}
       
   407 
       
   408     bool isConnected(const char *signalName);
       
   409 
       
   410     QGraphicsItem *finalFocusProxy(QGraphicsItem *item) const
       
   411     {
       
   412         QGraphicsItem *fp;
       
   413         while ((fp = item->focusProxy()))
       
   414             item = fp;
       
   415         return item;
       
   416     }
       
   417 
       
   418     //loop detection
       
   419     bool inPress:1;
       
   420     bool inRelease:1;
       
   421     bool inIM:1;
       
   422 
       
   423     bool enabled : 1;
       
   424 
       
   425     QGraphicsItem *imeItem;
       
   426     QList<QDeclarativeItem *> targets;
       
   427     QDeclarativeItem *item;
       
   428 };
       
   429 
       
   430 class QDeclarativeKeysAttached : public QObject, public QDeclarativeItemKeyFilter
       
   431 {
       
   432     Q_OBJECT
       
   433     Q_DECLARE_PRIVATE(QDeclarativeKeysAttached)
       
   434 
       
   435     Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
       
   436     Q_PROPERTY(QDeclarativeListProperty<QDeclarativeItem> forwardTo READ forwardTo)
       
   437     Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged)
       
   438 
       
   439     Q_ENUMS(Priority)
       
   440 
       
   441 public:
       
   442     QDeclarativeKeysAttached(QObject *parent=0);
       
   443     ~QDeclarativeKeysAttached();
       
   444 
       
   445     bool enabled() const { Q_D(const QDeclarativeKeysAttached); return d->enabled; }
       
   446     void setEnabled(bool enabled) {
       
   447         Q_D(QDeclarativeKeysAttached);
       
   448         if (enabled != d->enabled) {
       
   449             d->enabled = enabled;
       
   450             emit enabledChanged();
       
   451         }
       
   452     }
       
   453 
       
   454     enum Priority { BeforeItem, AfterItem};
       
   455     Priority priority() const;
       
   456     void setPriority(Priority);
       
   457 
       
   458     QDeclarativeListProperty<QDeclarativeItem> forwardTo() {
       
   459         Q_D(QDeclarativeKeysAttached);
       
   460         return QDeclarativeListProperty<QDeclarativeItem>(this, d->targets);
       
   461     }
       
   462 
       
   463     virtual void componentComplete();
       
   464 
       
   465     static QDeclarativeKeysAttached *qmlAttachedProperties(QObject *);
       
   466 
       
   467 Q_SIGNALS:
       
   468     void enabledChanged();
       
   469     void priorityChanged();
       
   470     void pressed(QDeclarativeKeyEvent *event);
       
   471     void released(QDeclarativeKeyEvent *event);
       
   472     void digit0Pressed(QDeclarativeKeyEvent *event);
       
   473     void digit1Pressed(QDeclarativeKeyEvent *event);
       
   474     void digit2Pressed(QDeclarativeKeyEvent *event);
       
   475     void digit3Pressed(QDeclarativeKeyEvent *event);
       
   476     void digit4Pressed(QDeclarativeKeyEvent *event);
       
   477     void digit5Pressed(QDeclarativeKeyEvent *event);
       
   478     void digit6Pressed(QDeclarativeKeyEvent *event);
       
   479     void digit7Pressed(QDeclarativeKeyEvent *event);
       
   480     void digit8Pressed(QDeclarativeKeyEvent *event);
       
   481     void digit9Pressed(QDeclarativeKeyEvent *event);
       
   482 
       
   483     void leftPressed(QDeclarativeKeyEvent *event);
       
   484     void rightPressed(QDeclarativeKeyEvent *event);
       
   485     void upPressed(QDeclarativeKeyEvent *event);
       
   486     void downPressed(QDeclarativeKeyEvent *event);
       
   487     void tabPressed(QDeclarativeKeyEvent *event);
       
   488     void backtabPressed(QDeclarativeKeyEvent *event);
       
   489 
       
   490     void asteriskPressed(QDeclarativeKeyEvent *event);
       
   491     void numberSignPressed(QDeclarativeKeyEvent *event);
       
   492     void escapePressed(QDeclarativeKeyEvent *event);
       
   493     void returnPressed(QDeclarativeKeyEvent *event);
       
   494     void enterPressed(QDeclarativeKeyEvent *event);
       
   495     void deletePressed(QDeclarativeKeyEvent *event);
       
   496     void spacePressed(QDeclarativeKeyEvent *event);
       
   497     void backPressed(QDeclarativeKeyEvent *event);
       
   498     void cancelPressed(QDeclarativeKeyEvent *event);
       
   499     void selectPressed(QDeclarativeKeyEvent *event);
       
   500     void yesPressed(QDeclarativeKeyEvent *event);
       
   501     void noPressed(QDeclarativeKeyEvent *event);
       
   502     void context1Pressed(QDeclarativeKeyEvent *event);
       
   503     void context2Pressed(QDeclarativeKeyEvent *event);
       
   504     void context3Pressed(QDeclarativeKeyEvent *event);
       
   505     void context4Pressed(QDeclarativeKeyEvent *event);
       
   506     void callPressed(QDeclarativeKeyEvent *event);
       
   507     void hangupPressed(QDeclarativeKeyEvent *event);
       
   508     void flipPressed(QDeclarativeKeyEvent *event);
       
   509     void menuPressed(QDeclarativeKeyEvent *event);
       
   510     void volumeUpPressed(QDeclarativeKeyEvent *event);
       
   511     void volumeDownPressed(QDeclarativeKeyEvent *event);
       
   512 
       
   513 private:
       
   514     virtual void keyPressed(QKeyEvent *event, bool post);
       
   515     virtual void keyReleased(QKeyEvent *event, bool post);
       
   516     virtual void inputMethodEvent(QInputMethodEvent *, bool post);
       
   517     virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
       
   518 
       
   519     const QByteArray keyToSignal(int key) {
       
   520         QByteArray keySignal;
       
   521         if (key >= Qt::Key_0 && key <= Qt::Key_9) {
       
   522             keySignal = "digit0Pressed";
       
   523             keySignal[5] = '0' + (key - Qt::Key_0);
       
   524         } else {
       
   525             int i = 0;
       
   526             while (sigMap[i].key && sigMap[i].key != key)
       
   527                 ++i;
       
   528             keySignal = sigMap[i].sig;
       
   529         }
       
   530         return keySignal;
       
   531     }
       
   532 
       
   533     struct SigMap {
       
   534         int key;
       
   535         const char *sig;
       
   536     };
       
   537 
       
   538     static const SigMap sigMap[];
       
   539 };
       
   540 
       
   541 Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeItemPrivate::ChangeTypes);
       
   542 
       
   543 QT_END_NAMESPACE
       
   544 
       
   545 QML_DECLARE_TYPE(QDeclarativeKeysAttached)
       
   546 QML_DECLARE_TYPEINFO(QDeclarativeKeysAttached, QML_HAS_ATTACHED_PROPERTIES)
       
   547 QML_DECLARE_TYPE(QDeclarativeKeyNavigationAttached)
       
   548 QML_DECLARE_TYPEINFO(QDeclarativeKeyNavigationAttached, QML_HAS_ATTACHED_PROPERTIES)
       
   549 
       
   550 #endif // QDECLARATIVEITEM_P_H