diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2017-09-08 11:04:30 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2017-09-08 11:04:30 +0200 |
commit | bde8c3cd9583ed9f3bdfc36a8699f56db20a6928 (patch) | |
tree | 33246b027739aafd72f9f289876f69627537f2b3 /src/quick/items/qquickitem.cpp | |
parent | b63bc868875d7571bc332804f984824cff7c5b78 (diff) | |
parent | 685ad676a84bf48602a5da8f7171792686b94a73 (diff) |
Merge remote-tracking branch 'origin/dev' into wip/new-backend
Conflicts:
src/qml/compiler/qv4isel_moth.cpp
src/qml/compiler/qv4jsir.cpp
src/qml/jsruntime/qv4mathobject.cpp
Change-Id: I426f1f4f0a5302b5bcff021de11766a03fec7637
Diffstat (limited to 'src/quick/items/qquickitem.cpp')
-rw-r--r-- | src/quick/items/qquickitem.cpp | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 9f2d543387..0a5d7adf8b 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -5029,22 +5029,31 @@ void QQuickItemPrivate::transformChanged() #endif } +bool QQuickItemPrivate::filterKeyEvent(QKeyEvent *e, bool post) +{ + if (!extra.isAllocated() || !extra->keyHandler) + return false; + + if (post) + e->accept(); + + if (e->type() == QEvent::KeyPress) + extra->keyHandler->keyPressed(e, post); + else + extra->keyHandler->keyReleased(e, post); + + return e->isAccepted(); +} + void QQuickItemPrivate::deliverKeyEvent(QKeyEvent *e) { Q_Q(QQuickItem); Q_ASSERT(e->isAccepted()); - if (extra.isAllocated() && extra->keyHandler) { - if (e->type() == QEvent::KeyPress) - extra->keyHandler->keyPressed(e, false); - else - extra->keyHandler->keyReleased(e, false); - - if (e->isAccepted()) - return; - else - e->accept(); - } + if (filterKeyEvent(e, false)) + return; + else + e->accept(); if (e->type() == QEvent::KeyPress) q->keyPressEvent(e); @@ -5054,16 +5063,7 @@ void QQuickItemPrivate::deliverKeyEvent(QKeyEvent *e) if (e->isAccepted()) return; - if (extra.isAllocated() && extra->keyHandler) { - e->accept(); - - if (e->type() == QEvent::KeyPress) - extra->keyHandler->keyPressed(e, true); - else - extra->keyHandler->keyReleased(e, true); - } - - if (e->isAccepted() || !q->window()) + if (filterKeyEvent(e, true) || !q->window()) return; //only care about KeyPress now @@ -5832,7 +5832,7 @@ void QQuickItem::setVisible(bool v) are returned to \c true, unless they have explicitly been set to \c false. Setting this property to \c false automatically causes \l activeFocus to be - set to \c false, and this item will longer receive keyboard events. + set to \c false, and this item will no longer receive keyboard events. \sa visible */ @@ -7231,6 +7231,8 @@ void QQuickItem::setAcceptHoverEvents(bool enabled) If this is false, then the item will not receive any touch events through the touchEvent() function. + + \since 5.10 */ bool QQuickItem::acceptTouchEvents() const { @@ -7242,12 +7244,14 @@ bool QQuickItem::acceptTouchEvents() const If \a enabled is true, this sets the item to accept touch events; otherwise, touch events are not accepted by this item. + \since 5.10 + \sa acceptTouchEvents() */ -void QQuickItem::setAcceptTouchEvents(bool accept) +void QQuickItem::setAcceptTouchEvents(bool enabled) { Q_D(QQuickItem); - d->touchEnabled = accept; + d->touchEnabled = enabled; } void QQuickItemPrivate::setHasCursorInChild(bool hasCursor) |