aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickwindow.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2016-07-22 10:49:32 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2016-08-02 18:34:30 +0200
commit74f0d15e08fe718fd406ac53e691e68f8ef46e11 (patch)
tree9b8b450a1033f065d9646298b3d0faa18a08577f /src/quick/items/qquickwindow.cpp
parentfa53d4e35433cc59e99b24f16f18c713683c1a80 (diff)
parent6839f03051d2950e4721cbb5ee88fa7b07109588 (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts: src/quick/items/qquickshadereffect.cpp 5.7 had a bug-fix in code dev has replaced wholesale. src/quick/items/qquickwindow.cpp src/quick/items/qquickwindow_p.h One side changed a method's signature; the other side renamed a method declared adjacent to it and changed some code using it, moving some from the public class to its private partner. tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp One side added a blank line before a comment the other re-wrote. Kept the re-write, killed the stray blank. .qmake.conf Ignore 5.7's change to MODULE_VERSION. src/qml/compiler/qqmltypecompiler.cpp src/qml/compiler/qqmlpropertyvalidator.cpp 5.7 changed code in the former that dev moved to the latter. Reflect 5.7's changes there, adapted to dev's form. src/qml/qml/qqmlobjectcreator.cpp One side added new QVariant types; the other changed how it handled each type of QVariant (without git seeing any conflict); adapted the new stanzas to work the same as the transformed ones. tests/manual/v4/test262 dev had a broken sha1 for it; so used 5.7's 9741ac4655808ac46c127e3d1d8ba3d27ada618e Change-Id: I1fbe2255b97d6ef405cdd1d0cea7fab8dc351d6f
Diffstat (limited to 'src/quick/items/qquickwindow.cpp')
-rw-r--r--src/quick/items/qquickwindow.cpp36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 56466fdbd1..a2c82c30a0 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -707,10 +707,10 @@ bool QQuickWindowPrivate::translateTouchToMouse(QQuickItem *item, QTouchEvent *e
lastMousePosition = me->windowPos();
bool accepted = me->isAccepted();
- bool delivered = deliverHoverEvent(contentItem, me->windowPos(), last, me->modifiers(), accepted);
+ bool delivered = deliverHoverEvent(contentItem, me->windowPos(), last, me->modifiers(), me->timestamp(), accepted);
if (!delivered) {
//take care of any exits
- accepted = clearHover();
+ accepted = clearHover(me->timestamp());
}
me->setAccepted(accepted);
break;
@@ -1488,7 +1488,7 @@ QQuickItem *QQuickWindow::mouseGrabberItem() const
}
-bool QQuickWindowPrivate::clearHover()
+bool QQuickWindowPrivate::clearHover(ulong timestamp)
{
Q_Q(QQuickWindow);
if (hoverItems.isEmpty())
@@ -1498,7 +1498,7 @@ bool QQuickWindowPrivate::clearHover()
bool accepted = false;
foreach (QQuickItem* item, hoverItems)
- accepted = sendHoverEvent(QEvent::HoverLeave, item, pos, pos, QGuiApplication::keyboardModifiers(), true) || accepted;
+ accepted = sendHoverEvent(QEvent::HoverLeave, item, pos, pos, QGuiApplication::keyboardModifiers(), timestamp, true) || accepted;
hoverItems.clear();
return accepted;
}
@@ -1678,6 +1678,12 @@ bool QQuickWindowPrivate::deliverMouseEvent(QMouseEvent *event)
}
if (mouseGrabberItem) {
+ if (event->button() != Qt::NoButton
+ && mouseGrabberItem->acceptedMouseButtons()
+ && !(mouseGrabberItem->acceptedMouseButtons() & event->button())) {
+ event->ignore();
+ return false;
+ }
QPointF localPos = mouseGrabberItem->mapFromScene(event->windowPos());
QScopedPointer<QMouseEvent> me(cloneMouseEvent(event, &localPos));
me->accept();
@@ -1692,13 +1698,15 @@ bool QQuickWindowPrivate::deliverMouseEvent(QMouseEvent *event)
bool QQuickWindowPrivate::sendHoverEvent(QEvent::Type type, QQuickItem *item,
const QPointF &scenePos, const QPointF &lastScenePos,
- Qt::KeyboardModifiers modifiers, bool accepted)
+ Qt::KeyboardModifiers modifiers, ulong timestamp,
+ bool accepted)
{
Q_Q(QQuickWindow);
const QTransform transform = QQuickItemPrivate::get(item)->windowToItemTransform();
//create copy of event
QHoverEvent hoverEvent(type, transform.map(scenePos), transform.map(lastScenePos), modifiers);
+ hoverEvent.setTimestamp(timestamp);
hoverEvent.setAccepted(accepted);
QSet<QQuickItem *> hasFiltered;
@@ -1712,7 +1720,7 @@ bool QQuickWindowPrivate::sendHoverEvent(QEvent::Type type, QQuickItem *item,
}
bool QQuickWindowPrivate::deliverHoverEvent(QQuickItem *item, const QPointF &scenePos, const QPointF &lastScenePos,
- Qt::KeyboardModifiers modifiers, bool &accepted)
+ Qt::KeyboardModifiers modifiers, ulong timestamp, bool &accepted)
{
Q_Q(QQuickWindow);
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
@@ -1730,7 +1738,7 @@ bool QQuickWindowPrivate::deliverHoverEvent(QQuickItem *item, const QPointF &sce
QQuickItem *child = children.at(ii);
if (!child->isVisible() || !child->isEnabled() || QQuickItemPrivate::get(child)->culled)
continue;
- if (deliverHoverEvent(child, scenePos, lastScenePos, modifiers, accepted))
+ if (deliverHoverEvent(child, scenePos, lastScenePos, modifiers, timestamp, accepted))
return true;
}
}
@@ -1740,7 +1748,7 @@ bool QQuickWindowPrivate::deliverHoverEvent(QQuickItem *item, const QPointF &sce
if (item->contains(p)) {
if (!hoverItems.isEmpty() && hoverItems[0] == item) {
//move
- accepted = sendHoverEvent(QEvent::HoverMove, item, scenePos, lastScenePos, modifiers, accepted);
+ accepted = sendHoverEvent(QEvent::HoverMove, item, scenePos, lastScenePos, modifiers, timestamp, accepted);
} else {
QList<QQuickItem *> itemsToHover;
QQuickItem* parent = item;
@@ -1751,12 +1759,12 @@ bool QQuickWindowPrivate::deliverHoverEvent(QQuickItem *item, const QPointF &sce
// Leaving from previous hovered items until we reach the item or one of its ancestors.
while (!hoverItems.isEmpty() && !itemsToHover.contains(hoverItems[0])) {
QQuickItem *hoverLeaveItem = hoverItems.takeFirst();
- sendHoverEvent(QEvent::HoverLeave, hoverLeaveItem, scenePos, lastScenePos, modifiers, accepted);
+ sendHoverEvent(QEvent::HoverLeave, hoverLeaveItem, scenePos, lastScenePos, modifiers, timestamp, accepted);
}
if (!hoverItems.isEmpty() && hoverItems[0] == item){//Not entering a new Item
// ### Shouldn't we send moves for the parent items as well?
- accepted = sendHoverEvent(QEvent::HoverMove, item, scenePos, lastScenePos, modifiers, accepted);
+ accepted = sendHoverEvent(QEvent::HoverMove, item, scenePos, lastScenePos, modifiers, timestamp, accepted);
} else {
// Enter items that are not entered yet.
int startIdx = -1;
@@ -1775,7 +1783,7 @@ bool QQuickWindowPrivate::deliverHoverEvent(QQuickItem *item, const QPointF &sce
// itemToHoverPrivate->window here prevents that case.
if (itemToHoverPrivate->window == q && itemToHoverPrivate->hoverEnabled) {
hoverItems.prepend(itemToHover);
- sendHoverEvent(QEvent::HoverEnter, itemToHover, scenePos, lastScenePos, modifiers, accepted);
+ sendHoverEvent(QEvent::HoverEnter, itemToHover, scenePos, lastScenePos, modifiers, timestamp, accepted);
}
}
}
@@ -2076,10 +2084,10 @@ void QQuickWindowPrivate::handleMouseEvent(QMouseEvent *event)
lastMousePosition = event->windowPos();
bool accepted = event->isAccepted();
- bool delivered = deliverHoverEvent(contentItem, event->windowPos(), last, event->modifiers(), accepted);
+ bool delivered = deliverHoverEvent(contentItem, event->windowPos(), last, event->modifiers(), event->timestamp(), accepted);
if (!delivered) {
//take care of any exits
- accepted = clearHover();
+ accepted = clearHover(event->timestamp());
}
event->setAccepted(accepted);
return;
@@ -2110,7 +2118,7 @@ void QQuickWindowPrivate::flushFrameSynchronousEvents()
// whether it has moved into a position where it is now under the cursor.
if (!mouseGrabberItem && !lastMousePosition.isNull()) {
bool accepted = false;
- bool delivered = deliverHoverEvent(contentItem, lastMousePosition, lastMousePosition, QGuiApplication::keyboardModifiers(), accepted);
+ bool delivered = deliverHoverEvent(contentItem, lastMousePosition, lastMousePosition, QGuiApplication::keyboardModifiers(), 0, accepted);
if (!delivered)
clearHover(); // take care of any exits
}