diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-07-14 00:17:19 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-07-14 00:17:19 (GMT) |
commit | 4bff499601509355cd4e2166357d7aa6f08f0b1c (patch) | |
tree | 6e54dc4551384350a08529cdbb66ca3169ec52f9 /src/declarative | |
parent | 74079574c31b41982357e8f809da4686a5d0fd75 (diff) | |
download | Qt-4bff499601509355cd4e2166357d7aa6f08f0b1c.zip Qt-4bff499601509355cd4e2166357d7aa6f08f0b1c.tar.gz Qt-4bff499601509355cd4e2166357d7aa6f08f0b1c.tar.bz2 |
Basic KeyProxy support.
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/fx/qfxitem.h | 6 | ||||
-rw-r--r-- | src/declarative/fx/qfxkeyproxy.cpp | 18 |
2 files changed, 21 insertions, 3 deletions
diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index 8c8bcc4..9df3c18 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -296,6 +296,10 @@ Q_SIGNALS: void qmlChanged(); void newChildCreated(const QString &url, QScriptValue); +public: //### for KeyProxy + void keyPressEvent(QKeyEvent *event); + void keyReleaseEvent(QKeyEvent *event); + protected: virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); virtual void childrenChanged(); @@ -312,8 +316,6 @@ protected: virtual void parentChanged(QFxItem *, QFxItem *); virtual void focusChanged(bool); virtual void activeFocusChanged(bool); - void keyPressEvent(QKeyEvent *event); - void keyReleaseEvent(QKeyEvent *event); virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); diff --git a/src/declarative/fx/qfxkeyproxy.cpp b/src/declarative/fx/qfxkeyproxy.cpp index e76a9b7..62f468c 100644 --- a/src/declarative/fx/qfxkeyproxy.cpp +++ b/src/declarative/fx/qfxkeyproxy.cpp @@ -40,9 +40,11 @@ ****************************************************************************/ #include "qfxkeyproxy.h" - +#include <QGraphicsScene> +#include <QKeyEvent> QT_BEGIN_NAMESPACE + QML_DEFINE_TYPE(QFxKeyProxy,KeyProxy) /*! @@ -94,11 +96,25 @@ QList<QFxItem *> *QFxKeyProxy::targets() const void QFxKeyProxy::keyPressEvent(QKeyEvent *e) { // ### GV + for (int ii = 0; ii < d->targets.count(); ++ii) { + QFxItem *i = d->targets.at(ii); //scene()->focusItem() + if (i) + i->keyPressEvent(e); + if (e->isAccepted()) + return; + } } void QFxKeyProxy::keyReleaseEvent(QKeyEvent *e) { // ### GV + for (int ii = 0; ii < d->targets.count(); ++ii) { + QFxItem *i = d->targets.at(ii); //scene()->focusItem() + if (i) + i->keyReleaseEvent(e); + if (e->isAccepted()) + return; + } } QT_END_NAMESPACE |