diff options
author | Liang Qi <liang.qi@qt.io> | 2017-02-24 10:14:57 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-02-24 11:48:14 +0100 |
commit | b1fa22c1683d9f6cedb001f5ef8a0dac71868935 (patch) | |
tree | c30a114c75be071310df974283b928329f9d5c12 /src/quick/items | |
parent | ba68c325688acf3072715757480497524f61c425 (diff) | |
parent | fe5d69669197a51662061b014810f0242eec5ca7 (diff) |
Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts:
src/qml/compiler/qv4ssa.cpp
src/quick/accessible/qaccessiblequickview_p.h
src/quick/items/qquickmousearea.cpp
src/quick/util/qquickanimatorjob.cpp
tools/qmlplugindump/main.cpp
Change-Id: I84474cf39895b9b757403971d2e9196e8c9d1809
Diffstat (limited to 'src/quick/items')
-rw-r--r-- | src/quick/items/context2d/qquickcontext2dtexture.cpp | 7 | ||||
-rw-r--r-- | src/quick/items/qquickflickable.cpp | 5 | ||||
-rw-r--r-- | src/quick/items/qquickitem.cpp | 10 | ||||
-rw-r--r-- | src/quick/items/qquickmousearea.cpp | 28 | ||||
-rw-r--r-- | src/quick/items/qquickopenglshadereffect.cpp | 10 | ||||
-rw-r--r-- | src/quick/items/qquickshadereffect.cpp | 5 | ||||
-rw-r--r-- | src/quick/items/qquickshadereffect_p.h | 2 | ||||
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 18 |
8 files changed, 57 insertions, 28 deletions
diff --git a/src/quick/items/context2d/qquickcontext2dtexture.cpp b/src/quick/items/context2d/qquickcontext2dtexture.cpp index 38b5f054bf..d90f527486 100644 --- a/src/quick/items/context2d/qquickcontext2dtexture.cpp +++ b/src/quick/items/context2d/qquickcontext2dtexture.cpp @@ -48,6 +48,7 @@ #include <QOpenGLFramebufferObject> #include <QOpenGLFramebufferObjectFormat> #include <QOpenGLFunctions> +#include <QtGui/private/qopenglextensions_p.h> #endif #include <QtCore/QThread> #include <QtGui/QGuiApplication> @@ -499,9 +500,9 @@ bool QQuickContext2DFBOTexture::doMultisampling() const static bool multisamplingSupported = false; if (!extensionsChecked) { - const QSet<QByteArray> extensions = QOpenGLContext::currentContext()->extensions(); - multisamplingSupported = extensions.contains(QByteArrayLiteral("GL_EXT_framebuffer_multisample")) - && extensions.contains(QByteArrayLiteral("GL_EXT_framebuffer_blit")); + QOpenGLExtensions *e = static_cast<QOpenGLExtensions *>(QOpenGLContext::currentContext()->functions()); + multisamplingSupported = e->hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample) + && e->hasOpenGLExtension(QOpenGLExtensions::FramebufferBlit); extensionsChecked = true; } diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 4ab604b30f..d97c731157 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -2349,8 +2349,11 @@ bool QQuickFlickable::filterMouseEvent(QQuickItem *receiver, QMouseEvent *event) bool QQuickFlickable::childMouseEventFilter(QQuickItem *i, QEvent *e) { Q_D(QQuickFlickable); - if (!isVisible() || !isEnabled() || !isInteractive()) + if (!isVisible() || !isEnabled() || !isInteractive()) { + d->cancelInteraction(); return QQuickItem::childMouseEventFilter(i, e); + } + switch (e->type()) { case QEvent::MouseButtonPress: case QEvent::MouseMove: diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index f7b9a58329..1a244b0dd9 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -2911,14 +2911,15 @@ void QQuickItemPrivate::addChild(QQuickItem *child) childItems.append(child); -#if QT_CONFIG(cursor) QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(child); +#if QT_CONFIG(cursor) // if the added child has a cursor and we do not currently have any children // with cursors, bubble the notification up if (childPrivate->subtreeCursorEnabled && !subtreeCursorEnabled) setHasCursorInChild(true); #endif + if (childPrivate->subtreeHoverEnabled && !subtreeHoverEnabled) setHasHoverInChild(true); @@ -2939,13 +2940,14 @@ void QQuickItemPrivate::removeChild(QQuickItem *child) childItems.removeOne(child); Q_ASSERT(!childItems.contains(child)); -#if QT_CONFIG(cursor) QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(child); +#if QT_CONFIG(cursor) // turn it off, if nothing else is using it if (childPrivate->subtreeCursorEnabled && subtreeCursorEnabled) setHasCursorInChild(false); #endif + if (childPrivate->subtreeHoverEnabled && subtreeHoverEnabled) setHasHoverInChild(false); @@ -3807,10 +3809,10 @@ QQuickItem::UpdatePaintNodeData::UpdatePaintNodeData() /*! This function is called when an item should release graphics - resources which are not already managed by the nodes returend from + resources which are not already managed by the nodes returned from QQuickItem::updatePaintNode(). - This happens when the item is about to be removed from window it + This happens when the item is about to be removed from the window it was previously rendering to. The item is guaranteed to have a \l {QQuickItem::window()}{window} when the function is called. diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp index bb23b1fd54..c662efe40e 100644 --- a/src/quick/items/qquickmousearea.cpp +++ b/src/quick/items/qquickmousearea.cpp @@ -689,9 +689,10 @@ void QQuickMouseArea::mousePressEvent(QMouseEvent *event) #endif setHovered(true); d->startScene = event->windowPos(); - d->pressAndHoldTimer.start(pressAndHoldInterval(), this); setKeepMouseGrab(d->stealMouse); event->setAccepted(setPressed(event->button(), true, event->source())); + if (event->isAccepted()) + d->pressAndHoldTimer.start(pressAndHoldInterval(), this); } } @@ -738,23 +739,34 @@ void QQuickMouseArea::mouseMoveEvent(QMouseEvent *event) bool dragY = drag()->axis() & QQuickDrag::YAxis; QPointF dragPos = d->drag->target()->position(); + QPointF boundedDragPos = dragPos; if (dragX) { - dragPos.setX(qBound( + dragPos.setX(startPos.x() + curLocalPos.x() - startLocalPos.x()); + boundedDragPos.setX(qBound( d->drag->xmin(), - startPos.x() + curLocalPos.x() - startLocalPos.x(), + dragPos.x(), d->drag->xmax())); } if (dragY) { - dragPos.setY(qBound( + dragPos.setY(startPos.y() + curLocalPos.y() - startLocalPos.y()); + boundedDragPos.setY(qBound( d->drag->ymin(), - startPos.y() + curLocalPos.y() - startLocalPos.y(), + dragPos.y(), d->drag->ymax())); } + + QPointF targetPos = d->drag->target()->position(); + if (d->drag->active()) - d->drag->target()->setPosition(dragPos); + d->drag->target()->setPosition(boundedDragPos); + + bool dragOverThresholdX = QQuickWindowPrivate::dragOverThreshold(dragPos.x() - startPos.x(), + Qt::XAxis, event, d->drag->threshold()); + bool dragOverThresholdY = QQuickWindowPrivate::dragOverThreshold(dragPos.y() - startPos.y(), + Qt::YAxis, event, d->drag->threshold()); - if (!d->overThreshold && (QQuickWindowPrivate::dragOverThreshold(dragPos.x() - startPos.x(), Qt::XAxis, event, d->drag->threshold()) - || QQuickWindowPrivate::dragOverThreshold(dragPos.y() - startPos.y(), Qt::YAxis, event, d->drag->threshold()))) + if (!d->overThreshold && (((targetPos.x() != boundedDragPos.x()) && dragOverThresholdX) || + ((targetPos.y() != boundedDragPos.y()) && dragOverThresholdY))) { d->overThreshold = true; if (d->drag->smoothed()) diff --git a/src/quick/items/qquickopenglshadereffect.cpp b/src/quick/items/qquickopenglshadereffect.cpp index 42fcee3c0d..4f4c403483 100644 --- a/src/quick/items/qquickopenglshadereffect.cpp +++ b/src/quick/items/qquickopenglshadereffect.cpp @@ -256,10 +256,14 @@ void QQuickOpenGLShaderEffectCommon::connectPropertySignals(QQuickItem *item, qWarning("QQuickOpenGLShaderEffect: property '%s' does not have notification method!", d.name.constData()); } else { auto *mapper = signalMappers[shaderType].at(i); - mapper->setSignalIndex(pd->notifyIndex()); + mapper->setSignalIndex(itemMetaObject->property(d.propertyIndex).notifySignal().methodIndex()); Q_ASSERT(item->metaObject() == itemMetaObject); - QObjectPrivate::connectImpl(item, mapper->signalIndex(), item, nullptr, mapper, - Qt::AutoConnection, nullptr, itemMetaObject); + bool ok = QObjectPrivate::connectImpl(item, pd->notifyIndex(), item, nullptr, mapper, + Qt::AutoConnection, nullptr, itemMetaObject); + if (!ok) + qWarning() << "Failed to connect to property" << itemMetaObject->property(d.propertyIndex).name() + << "(" << d.propertyIndex << ", signal index" << pd->notifyIndex() + << ") of item" << item; } } else { // If the source is set via a dynamic property, like the layer is, then we need this diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp index 7926607e33..436d7b33ce 100644 --- a/src/quick/items/qquickshadereffect.cpp +++ b/src/quick/items/qquickshadereffect.cpp @@ -873,4 +873,9 @@ void QQuickShaderEffectPrivate::updatePolish() q->m_impl->maybeUpdateShaders(); } +bool QQuickShaderEffect::isOpenGLShaderEffect() const +{ + return m_glImpl != Q_NULLPTR; +} + QT_END_NAMESPACE diff --git a/src/quick/items/qquickshadereffect_p.h b/src/quick/items/qquickshadereffect_p.h index 7885daffbb..d269dc5e50 100644 --- a/src/quick/items/qquickshadereffect_p.h +++ b/src/quick/items/qquickshadereffect_p.h @@ -117,6 +117,8 @@ public: bool isComponentComplete() const; QString parseLog(); + bool isOpenGLShaderEffect() const; + Q_SIGNALS: void fragmentShaderChanged(); void vertexShaderChanged(); diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 57810e4ec9..f90384b3b6 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -635,8 +635,8 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve // FIXME: make this work for mouse events too and get rid of the asTouchEvent in here. Q_ASSERT(pointerEvent->asPointerTouchEvent()); - QTouchEvent *event = pointerEvent->asPointerTouchEvent()->touchEventForItem(item); - if (!event) + QScopedPointer<QTouchEvent> event(pointerEvent->asPointerTouchEvent()->touchEventForItem(item)); + if (event.isNull()) return false; // For each point, check if it is accepted, if not, try the next point. @@ -653,7 +653,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve break; qCDebug(DBG_TOUCH_TARGET) << "TP (mouse)" << p.id() << "->" << item; - QScopedPointer<QMouseEvent> mousePress(touchToMouseEvent(QEvent::MouseButtonPress, p, event, item, false)); + QScopedPointer<QMouseEvent> mousePress(touchToMouseEvent(QEvent::MouseButtonPress, p, event.data(), item, false)); // Send a single press and see if that's accepted QCoreApplication::sendEvent(item, mousePress.data()); @@ -667,7 +667,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve pointerEventPoint->setGrabber(item); if (checkIfDoubleClicked(event->timestamp())) { - QScopedPointer<QMouseEvent> mouseDoubleClick(touchToMouseEvent(QEvent::MouseButtonDblClick, p, event, item, false)); + QScopedPointer<QMouseEvent> mouseDoubleClick(touchToMouseEvent(QEvent::MouseButtonDblClick, p, event.data(), item, false)); QCoreApplication::sendEvent(item, mouseDoubleClick.data()); event->setAccepted(mouseDoubleClick->isAccepted()); if (!mouseDoubleClick->isAccepted()) { @@ -684,7 +684,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve } else if (touchMouseDevice == device && p.id() == touchMouseId) { if (p.state() & Qt::TouchPointMoved) { if (QQuickItem *mouseGrabberItem = q->mouseGrabberItem()) { - QScopedPointer<QMouseEvent> me(touchToMouseEvent(QEvent::MouseMove, p, event, mouseGrabberItem, false)); + QScopedPointer<QMouseEvent> me(touchToMouseEvent(QEvent::MouseMove, p, event.data(), mouseGrabberItem, false)); QCoreApplication::sendEvent(item, me.data()); event->setAccepted(me->isAccepted()); if (me->isAccepted()) { @@ -695,7 +695,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve // no grabber, check if we care about mouse hover // FIXME: this should only happen once, not recursively... I'll ignore it just ignore hover now. // hover for touch??? - QScopedPointer<QMouseEvent> me(touchToMouseEvent(QEvent::MouseMove, p, event, item, false)); + QScopedPointer<QMouseEvent> me(touchToMouseEvent(QEvent::MouseMove, p, event.data(), item, false)); if (lastMousePosition.isNull()) lastMousePosition = me->windowPos(); QPointF last = lastMousePosition; @@ -713,7 +713,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve } else if (p.state() & Qt::TouchPointReleased) { // currently handled point was released if (QQuickItem *mouseGrabberItem = q->mouseGrabberItem()) { - QScopedPointer<QMouseEvent> me(touchToMouseEvent(QEvent::MouseButtonRelease, p, event, mouseGrabberItem, false)); + QScopedPointer<QMouseEvent> me(touchToMouseEvent(QEvent::MouseButtonRelease, p, event.data(), mouseGrabberItem, false)); QCoreApplication::sendEvent(item, me.data()); if (item->acceptHoverEvents() && p.screenPos() != QGuiApplicationPrivate::lastCursorPosition) { @@ -4495,8 +4495,8 @@ QSGRendererInterface *QQuickWindow::rendererInterface() const \note The call to the function must happen before constructing the first QQuickWindow in the application. It cannot be changed afterwards. - If \a backend is invalid or an error occurs, the default backend (OpenGL or - software, depending on the Qt configuration) is used. + If the selected backend is invalid or an error occurs, the default backend + (OpenGL or software, depending on the Qt configuration) is used. \since 5.8 */ |