diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-09-07 03:13:25 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-09-07 03:13:25 (GMT) |
commit | 9008c7002ffe6617ffcd602a7a9923e83e8b8f80 (patch) | |
tree | 784c075dccc463b8c40311455747a325f4ff3295 | |
parent | 16cdd82a88a63ea050ab2cf70368e023fe50c5bd (diff) | |
download | Qt-9008c7002ffe6617ffcd602a7a9923e83e8b8f80.zip Qt-9008c7002ffe6617ffcd602a7a9923e83e8b8f80.tar.gz Qt-9008c7002ffe6617ffcd602a7a9923e83e8b8f80.tar.bz2 |
Remove KeyProxy in favour of the Keys.forwardTo attached property.
-rw-r--r-- | demos/declarative/contacts/contacts.qml | 6 | ||||
-rw-r--r-- | demos/declarative/flickr/common/MediaLineEdit.qml | 9 | ||||
-rw-r--r-- | demos/declarative/flickr/mobile/TitleBar.qml | 8 | ||||
-rw-r--r-- | demos/declarative/twitter/content/AuthView.qml | 6 | ||||
-rw-r--r-- | demos/declarative/twitter/content/HomeTitleBar.qml | 8 | ||||
-rw-r--r-- | src/declarative/QmlChanges.txt | 1 | ||||
-rw-r--r-- | src/declarative/fx/fx.pri | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfxitem.cpp | 192 | ||||
-rw-r--r-- | src/declarative/fx/qfxitem.h | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfxkeyproxy.cpp | 212 | ||||
-rw-r--r-- | src/declarative/fx/qfxkeyproxy.h | 83 |
11 files changed, 198 insertions, 331 deletions
diff --git a/demos/declarative/contacts/contacts.qml b/demos/declarative/contacts/contacts.qml index f009631..278eeb3 100644 --- a/demos/declarative/contacts/contacts.qml +++ b/demos/declarative/contacts/contacts.qml @@ -290,10 +290,8 @@ Rectangle { } ] } - KeyProxy { - focus: contacts.mode != 'new' - targets: { contacts.mode == "list" ? [searchBarWrapper, contactListView] : [contactListView]} - } + focus: contacts.mode != 'new' + forwardTo: { contacts.mode == "list" ? [searchBarWrapper, contactListView] : [contactListView]} states: [ State { name: "editNewState" diff --git a/demos/declarative/flickr/common/MediaLineEdit.qml b/demos/declarative/flickr/common/MediaLineEdit.qml index eab0b95..094571f 100644 --- a/demos/declarative/flickr/common/MediaLineEdit.qml +++ b/demos/declarative/flickr/common/MediaLineEdit.qml @@ -26,7 +26,7 @@ Item { width: 100 } PropertyChanges { - target: Proxy + target: Container focus: true } StateChangeScript { @@ -96,12 +96,7 @@ Item { anchors.left: Label.right anchors.verticalCenter: Container.verticalCenter } - KeyProxy { - id: Proxy - anchors.left: Container.left - anchors.fill: Container - targets: [(ReturnKey), (Editor)] - } + Keys.forwardTo: [(ReturnKey), (Editor)] Item { id: ReturnKey Keys.onReturnPressed: "Container.state = ''" diff --git a/demos/declarative/flickr/mobile/TitleBar.qml b/demos/declarative/flickr/mobile/TitleBar.qml index 79c1326..b95452a 100644 --- a/demos/declarative/flickr/mobile/TitleBar.qml +++ b/demos/declarative/flickr/mobile/TitleBar.qml @@ -53,11 +53,7 @@ Item { color: "#151515"; highlightColor: "Green" } - KeyProxy { - id: Proxy - anchors.fill: parent - targets: [(ReturnKey), (Editor)] - } + Keys.forwardTo: [ (ReturnKey), (Editor)] Item { id: ReturnKey @@ -71,7 +67,7 @@ Item { name: "Tags" PropertyChanges { target: Container; x: -TagButton.x + 5 } PropertyChanges { target: TagButton; text: "OK" } - PropertyChanges { target: Proxy; focus: true } + PropertyChanges { target: LineEdit; focus: true } } transitions: Transition { diff --git a/demos/declarative/twitter/content/AuthView.qml b/demos/declarative/twitter/content/AuthView.qml index 9ca4d88..7d0d865 100644 --- a/demos/declarative/twitter/content/AuthView.qml +++ b/demos/declarative/twitter/content/AuthView.qml @@ -29,11 +29,7 @@ Item { maximumLength:21 font.bold: true color: "#151515"; highlightColor: "green" - KeyProxy { - id: Proxy - targets: [(tabber), (nameIn)] - focus: true - } + Keys.forwardTo: [(tabber), (nameIn)] Item { id: tabber //Note: it's not working yet diff --git a/demos/declarative/twitter/content/HomeTitleBar.qml b/demos/declarative/twitter/content/HomeTitleBar.qml index 5cb8bea..9bca2c8 100644 --- a/demos/declarative/twitter/content/HomeTitleBar.qml +++ b/demos/declarative/twitter/content/HomeTitleBar.qml @@ -94,11 +94,7 @@ Item { wrap:true color: "#151515"; highlightColor: "green" } - KeyProxy { - id: Proxy - anchors.fill: parent - targets: [(ReturnKey), (Editor)] - } + Keys.forwardTo: [(ReturnKey), (Editor)] Item { id: ReturnKey Keys.onReturnPressed: accept() @@ -114,7 +110,7 @@ Item { PropertyChanges { target: TagButton; text: "OK" } PropertyChanges { target: TagButton; width: 28 } PropertyChanges { target: TagButton; height: 24 } - PropertyChanges { target: Proxy; focus: true } + PropertyChanges { target: txtEdit; focus: true } } ] transitions: [ diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index b24f6fe..8247a35 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -77,6 +77,7 @@ Other Changes: Drag: axis becomes an enum with values "XAxis", "YAxis", "XandYAxis" Image: scaleGrid property removed. New item called BorderImage instead. KeyActions: changed to a Keys attached property on any item. +KeyProxy: changed to a Keys.forwardTo property on any item. Pending Changes =============== diff --git a/src/declarative/fx/fx.pri b/src/declarative/fx/fx.pri index 63ac818..80a6fdd 100644 --- a/src/declarative/fx/fx.pri +++ b/src/declarative/fx/fx.pri @@ -20,7 +20,6 @@ HEADERS += \ fx/qfxitem_p.h \ fx/qfxfocuspanel.h \ fx/qfxfocusscope.h \ - fx/qfxkeyproxy.h \ fx/qfxpositioners.h \ fx/qfxpositioners_p.h \ fx/qfxloader.h \ @@ -62,7 +61,6 @@ SOURCES += \ fx/qfxitem.cpp \ fx/qfxfocuspanel.cpp \ fx/qfxfocusscope.cpp \ - fx/qfxkeyproxy.cpp \ fx/qfxpositioners.cpp \ fx/qfxloader.cpp \ fx/qfxmouseregion.cpp \ diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index d28f531..9f3e301 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -334,6 +334,8 @@ public: virtual void keyPressed(QKeyEvent *event); virtual void keyReleased(QKeyEvent *event); + virtual void inputMethodEvent(QInputMethodEvent *event); + virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; private: QFxItemKeyFilter *m_next; @@ -364,6 +366,17 @@ void QFxItemKeyFilter::keyReleased(QKeyEvent *event) if (m_next) m_next->keyReleased(event); } +void QFxItemKeyFilter::inputMethodEvent(QInputMethodEvent *event) +{ + if (m_next) m_next->inputMethodEvent(event); +} + +QVariant QFxItemKeyFilter::inputMethodQuery(Qt::InputMethodQuery query) const +{ + if (m_next) return m_next->inputMethodQuery(query); + return QVariant(); +} + class QFxKeyNavigationAttachedPrivate : public QObjectPrivate { public: @@ -592,6 +605,25 @@ void QFxKeyNavigationAttached::keyReleased(QKeyEvent *event) */ /*! + \qmlproperty List<Object> Keys::forwardTo + + This property provides a way to forward key presses, key releases, and keyboard input + coming from input methods to other items. This can be useful when you want + one item to handle some keys (e.g. the up and down arrow keys), and another item to + handle other keys (e.g. the left and right arrow keys). Once an item that has been + forwarded keys accepts the event it is no longer forwarded to items later in the + list. + + This example forwards key events to two lists: + \qml + ListView { id: List1 ... } + ListView { id: List2 ... } + Keys.forwardTo: [List1, List2] + focus: true + \endqml +*/ + +/*! \qmlsignal Keys::onPressed(event) This handler is called when a key has been pressed. The \a event @@ -853,19 +885,42 @@ void QFxKeyNavigationAttached::keyReleased(QKeyEvent *event) class QFxKeysAttachedPrivate : public QObjectPrivate { public: - QFxKeysAttachedPrivate() : QObjectPrivate(), enabled(true) {} + QFxKeysAttachedPrivate() + : QObjectPrivate(), inPress(false), inRelease(false) + , inIM(false), enabled(true), imeItem(0), item(0) + {} bool isConnected(const char *signalName); - bool enabled; + QGraphicsItem *finalFocusProxy(QGraphicsItem *item) const + { + QGraphicsItem *fp; + while ((fp = item->focusProxy())) + item = fp; + return item; + } + + //loop detection + bool inPress:1; + bool inRelease:1; + bool inIM:1; + + bool enabled : 1; + + QGraphicsItem *imeItem; + QList<QFxItem *> targets; + QFxItem *item; }; -class QFxKeysAttached : public QObject, public QFxItemKeyFilter +class QFxKeysAttached : public QObject, public QFxItemKeyFilter, public QmlParserStatus { Q_OBJECT - Q_DECLARE_PRIVATE(QFxKeysAttached); + Q_DECLARE_PRIVATE(QFxKeysAttached) + Q_INTERFACES(QmlParserStatus) Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) + Q_PROPERTY(QList<QFxItem *> *forwardTo READ forwardTo) + public: QFxKeysAttached(QObject *parent=0); ~QFxKeysAttached(); @@ -879,6 +934,13 @@ public: } } + QList<QFxItem *> *forwardTo() { + Q_D(QFxKeysAttached); + return &d->targets; + } + + virtual void componentComplete(); + static QFxKeysAttached *qmlAttachedProperties(QObject *); Q_SIGNALS: @@ -927,6 +989,8 @@ Q_SIGNALS: private: virtual void keyPressed(QKeyEvent *event); virtual void keyReleased(QKeyEvent *event); + virtual void inputMethodEvent(QInputMethodEvent *); + virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; const QByteArray keyToSignal(int key) { QByteArray keySignal; @@ -989,20 +1053,52 @@ QFxKeysAttached::QFxKeysAttached(QObject *parent) : QObject(*(new QFxKeysAttachedPrivate), parent), QFxItemKeyFilter(qobject_cast<QFxItem*>(parent)) { + Q_D(QFxKeysAttached); + d->item = qobject_cast<QFxItem*>(parent); } QFxKeysAttached::~QFxKeysAttached() { } +void QFxKeysAttached::componentComplete() +{ + Q_D(QFxKeysAttached); + if (d->item) { + for (int ii = 0; ii < d->targets.count(); ++ii) { + QGraphicsItem *targetItem = d->finalFocusProxy(d->targets.at(ii)); + if (targetItem && (targetItem->flags() & QGraphicsItem::ItemAcceptsInputMethod)) { + d->item->setFlag(QGraphicsItem::ItemAcceptsInputMethod); + break; + } + } + } +} + void QFxKeysAttached::keyPressed(QKeyEvent *event) { Q_D(QFxKeysAttached); - if (!d->enabled) { + if (!d->enabled || d->inPress) { event->ignore(); return; } + // first process forwards + if (d->item && d->item->scene()) { + d->inPress = true; + for (int ii = 0; ii < d->targets.count(); ++ii) { + QGraphicsItem *i = d->finalFocusProxy(d->targets.at(ii)); + if (i) { + d->item->scene()->sendEvent(i, event); + if (event->isAccepted()) { + d->inPress = false; + return; + } + } + } + d->inPress = false; + } + QFxKeyEvent ke(*event); QByteArray keySignal = keyToSignal(event->key()); if (!keySignal.isEmpty()) { @@ -1024,10 +1120,26 @@ void QFxKeysAttached::keyPressed(QKeyEvent *event) void QFxKeysAttached::keyReleased(QKeyEvent *event) { Q_D(QFxKeysAttached); - if (!d->enabled) { + if (!d->enabled || d->inRelease) { event->ignore(); return; } + + if (d->item && d->item->scene()) { + d->inRelease = true; + for (int ii = 0; ii < d->targets.count(); ++ii) { + QGraphicsItem *i = d->finalFocusProxy(d->targets.at(ii)); + if (i) { + d->item->scene()->sendEvent(i, event); + if (event->isAccepted()) { + d->inRelease = false; + return; + } + } + } + d->inRelease = false; + } + QFxKeyEvent ke(*event); emit released(&ke); event->setAccepted(ke.isAccepted()); @@ -1035,6 +1147,52 @@ void QFxKeysAttached::keyReleased(QKeyEvent *event) if (!event->isAccepted()) QFxItemKeyFilter::keyReleased(event); } +void QFxKeysAttached::inputMethodEvent(QInputMethodEvent *event) +{ + Q_D(QFxKeysAttached); + if (d->item && !d->inIM && d->item->scene()) { + d->inIM = true; + for (int ii = 0; ii < d->targets.count(); ++ii) { + QGraphicsItem *i = d->finalFocusProxy(d->targets.at(ii)); + if (i && (i->flags() & QGraphicsItem::ItemAcceptsInputMethod)) { + d->item->scene()->sendEvent(i, event); + if (event->isAccepted()) { + d->imeItem = i; + d->inIM = false; + return; + } + } + } + d->inIM = false; + } + if (!event->isAccepted()) QFxItemKeyFilter::inputMethodEvent(event); +} + +class QFxItemAccessor : public QGraphicsItem +{ +public: + QVariant doInputMethodQuery(Qt::InputMethodQuery query) const { + return QGraphicsItem::inputMethodQuery(query); + } +}; + +QVariant QFxKeysAttached::inputMethodQuery(Qt::InputMethodQuery query) const +{ + Q_D(const QFxKeysAttached); + if (d->item) { + for (int ii = 0; ii < d->targets.count(); ++ii) { + QGraphicsItem *i = d->finalFocusProxy(d->targets.at(ii)); + if (i && (i->flags() & QGraphicsItem::ItemAcceptsInputMethod) && i == d->imeItem) { //### how robust is i == d->imeItem check? + QVariant v = static_cast<QFxItemAccessor *>(i)->doInputMethodQuery(query); + if (v.type() == QVariant::RectF) + v = d->item->mapRectFromItem(i, v.toRectF()); //### cost? + return v; + } + } + } + return QFxItemKeyFilter::inputMethodQuery(query); +} + QFxKeysAttached *QFxKeysAttached::qmlAttachedProperties(QObject *obj) { return new QFxKeysAttached(obj); @@ -1672,6 +1830,28 @@ void QFxItem::keyReleaseEvent(QKeyEvent *event) event->ignore(); } +void QFxItem::inputMethodEvent(QInputMethodEvent *event) +{ + Q_D(QFxItem); + if (d->keyHandler) + d->keyHandler->inputMethodEvent(event); + else + event->ignore(); +} + +QVariant QFxItem::inputMethodQuery(Qt::InputMethodQuery query) const +{ + Q_D(const QFxItem); + QVariant v; + if (d->keyHandler) + v = d->keyHandler->inputMethodQuery(query); + + if (!v.isValid()) + v = QGraphicsObject::inputMethodQuery(query); + + return v; +} + /*! \qmlproperty string Item::id This property holds the identifier for the item. diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index 5b95478..643987d 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -181,6 +181,8 @@ protected: virtual void activeFocusChanged(bool); virtual void keyPressEvent(QKeyEvent *event); virtual void keyReleaseEvent(QKeyEvent *event); + virtual void inputMethodEvent(QInputMethodEvent *); + virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); diff --git a/src/declarative/fx/qfxkeyproxy.cpp b/src/declarative/fx/qfxkeyproxy.cpp deleted file mode 100644 index b22d686..0000000 --- a/src/declarative/fx/qfxkeyproxy.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qfxkeyproxy.h" -#include <QGraphicsScene> -#include <QKeyEvent> - -QT_BEGIN_NAMESPACE - -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,KeyProxy,QFxKeyProxy) - -/*! - \qmlclass KeyProxy - \brief The KeyProxy item proxies key events to a number of other items. - \inherits Item - - KeyProxy provides a way to forward key presses, key releases, and keyboard input - coming from input methods to other items. This can be useful when you want - one item to handle some keys (e.g. the up and down arrow keys), and another item to - handle other keys (e.g. the left and right arrow keys). - - To receive key events, the KeyProxy item must be in the current focus chain, - just like any other item. - - KeyProxy is an invisible item: it is never painted. - - A simple KeyProxy that forward key events to two lists: - \qml - ListView { id: List1 ... } - ListView { id: List2 ... } - KeyProxy { - focus: true - targets: [List1, List2] - } - \endqml -*/ - -/*! - \internal - \class QFxKeyProxy - \brief The QFxKeyProxy class proxies key events to a number of other items. -*/ - -class QFxKeyProxyPrivate -{ -public: - QFxKeyProxyPrivate() : inPress(false), inRelease(false), inIM(false), imeItem(0) {} - QList<QFxItem *> targets; - - QGraphicsItem *finalFocusProxy(QGraphicsItem *item) - { - QGraphicsItem *fp; - while ((fp = item->focusProxy())) - item = fp; - return item; - } - - //loop detection - bool inPress:1; - bool inRelease:1; - bool inIM:1; - - QGraphicsItem *imeItem; -}; - -QFxKeyProxy::QFxKeyProxy(QFxItem *parent) -: QFxItem(parent), d(new QFxKeyProxyPrivate) -{ - setFlag(QGraphicsItem::ItemAcceptsInputMethod); -} - -QFxKeyProxy::~QFxKeyProxy() -{ - delete d; d = 0; -} - -/*! - \qmlproperty list<Item> KeyProxy::targets - - An ordered list of the items that will be forwarded key events. - - The events will be forwarded to the targets in turn until one of them - accepts the event. -*/ - -QList<QFxItem *> *QFxKeyProxy::targets() const -{ - return &d->targets; -} - -void QFxKeyProxy::keyPressEvent(QKeyEvent *e) -{ - if (!scene()) - return; - if (!d->inPress) { - d->inPress = true; - for (int ii = 0; ii < d->targets.count(); ++ii) { - QGraphicsItem *i = d->finalFocusProxy(d->targets.at(ii)); - if (i) { - scene()->sendEvent(i, e); - if (e->isAccepted()) { - d->inPress = false; - return; - } - } - } - d->inPress = false; - } -} - -void QFxKeyProxy::keyReleaseEvent(QKeyEvent *e) -{ - if (!scene()) - return; - if (!d->inRelease) { - d->inRelease = true; - for (int ii = 0; ii < d->targets.count(); ++ii) { - QGraphicsItem *i = d->finalFocusProxy(d->targets.at(ii)); - if (i) { - scene()->sendEvent(i, e); - if (e->isAccepted()) { - d->inRelease = false; - return; - } - } - } - d->inRelease = false; - } -} - -void QFxKeyProxy::inputMethodEvent(QInputMethodEvent *e) -{ - if (!scene()) - return; - if (!d->inIM) { - d->inIM = true; - for (int ii = 0; ii < d->targets.count(); ++ii) { - QGraphicsItem *i = d->finalFocusProxy(d->targets.at(ii)); - if (i && (i->flags() & ItemAcceptsInputMethod)) { - scene()->sendEvent(i, e); - if (e->isAccepted()) { - d->imeItem = i; - d->inIM = false; - return; - } - } - } - d->inIM = false; - } -} - -class QFxItemAccessor : public QGraphicsItem -{ -public: - QVariant doInputMethodQuery(Qt::InputMethodQuery query) const { - return QGraphicsItem::inputMethodQuery(query); - } -}; - -QVariant QFxKeyProxy::inputMethodQuery(Qt::InputMethodQuery query) const -{ - for (int ii = 0; ii < d->targets.count(); ++ii) { - QGraphicsItem *i = d->finalFocusProxy(d->targets.at(ii)); - if (i && (i->flags() & ItemAcceptsInputMethod) && i == d->imeItem) { //### how robust is i == d->imeItem check? - QVariant v = static_cast<QFxItemAccessor *>(i)->doInputMethodQuery(query); - if (v.type() == QVariant::RectF) - v = mapRectFromItem(i, v.toRectF()); //### cost? - return v; - } - } - return QFxItem::inputMethodQuery(query); -} - -QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxkeyproxy.h b/src/declarative/fx/qfxkeyproxy.h deleted file mode 100644 index d5f8c7c..0000000 --- a/src/declarative/fx/qfxkeyproxy.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QFXKEYPROXY_H -#define QFXKEYPROXY_H - -#include <QtDeclarative/qfxitem.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -//### move to Keys attached property as Keys.forwardTo - -class QFxKeyProxyPrivate; -class Q_DECLARATIVE_EXPORT QFxKeyProxy : public QFxItem -{ - Q_OBJECT - Q_PROPERTY(QList<QFxItem *> *targets READ targets) -public: - QFxKeyProxy(QFxItem *parent=0); - virtual ~QFxKeyProxy(); - - QList<QFxItem *> *targets() const; - -protected: - virtual void keyPressEvent(QKeyEvent *); - virtual void keyReleaseEvent(QKeyEvent *); - virtual void inputMethodEvent(QInputMethodEvent *); - virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; - -private: - Q_DISABLE_COPY(QFxKeyProxy) - QFxKeyProxyPrivate *d; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QFxKeyProxy) - -QT_END_HEADER - -#endif // QFXKEYPROXY_H |