diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-12-12 01:00:38 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2018-12-12 13:08:25 +0100 |
commit | 39643ef86e8bc48b8b6cf83ac0ebae7411029030 (patch) | |
tree | 79277e468160ebc04a65a85c9668dabefbf3ce33 /src/quick | |
parent | 489d6c28dda51c187c85017e30c1e018420e26ac (diff) | |
parent | e3446c8225acbaa6a613d6c62e8e2fc58e2b70b0 (diff) |
Merge remote-tracking branch 'origin/5.12' into dev
Conflicts:
tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
Change-Id: Ic1dace832ad4b29023d24808b8617b5dcc915eb5
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/handlers/qquicktaphandler.cpp | 4 | ||||
-rw-r--r-- | src/quick/items/qquickevents_p_p.h | 1 | ||||
-rw-r--r-- | src/quick/items/qquickitem.cpp | 23 | ||||
-rw-r--r-- | src/quick/items/qquickitem_p.h | 1 | ||||
-rw-r--r-- | src/quick/items/qquickitemsmodule.cpp | 16 | ||||
-rw-r--r-- | src/quick/items/qquicktext.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 9 | ||||
-rw-r--r-- | src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp | 7 | ||||
-rw-r--r-- | src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp | 3 | ||||
-rw-r--r-- | src/quick/util/qquickstyledtext.cpp | 22 |
10 files changed, 65 insertions, 23 deletions
diff --git a/src/quick/handlers/qquicktaphandler.cpp b/src/quick/handlers/qquicktaphandler.cpp index e97722d6b7..d480d3b491 100644 --- a/src/quick/handlers/qquicktaphandler.cpp +++ b/src/quick/handlers/qquicktaphandler.cpp @@ -107,6 +107,10 @@ static bool dragOverThreshold(const QQuickEventPoint *point) bool QQuickTapHandler::wantsEventPoint(QQuickEventPoint *point) { + if (!point->pointerEvent()->asPointerMouseEvent() && + !point->pointerEvent()->asPointerTouchEvent() && + !point->pointerEvent()->asPointerTabletEvent() ) + return false; // If the user has not violated any constraint, it could be a tap. // Otherwise we want to give up the grab so that a competing handler // (e.g. DragHandler) gets a chance to take over. diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h index d1a8bbd901..e614b1bd6d 100644 --- a/src/quick/items/qquickevents_p_p.h +++ b/src/quick/items/qquickevents_p_p.h @@ -723,5 +723,6 @@ QML_DECLARE_TYPE(QQuickCloseEvent) QML_DECLARE_TYPE(QQuickPointerDevice) QML_DECLARE_TYPE(QPointingDeviceUniqueId) QML_DECLARE_TYPE(QQuickPointerEvent) +Q_DECLARE_METATYPE(QQuickEventPoint::GrabTransition) #endif // QQUICKEVENTS_P_P_H diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index f58e08038f..0cd4c446d9 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -89,6 +89,7 @@ QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(DBG_MOUSE_TARGET) Q_DECLARE_LOGGING_CATEGORY(DBG_HOVER_TRACE) Q_DECLARE_LOGGING_CATEGORY(lcTransient) +Q_LOGGING_CATEGORY(lcHandlerParent, "qt.quick.handler.parent") void debugFocusTree(QQuickItem *item, QQuickItem *scope = nullptr, int depth = 1) { @@ -3280,12 +3281,11 @@ void QQuickItemPrivate::data_append(QQmlListProperty<QObject> *prop, QObject *o) if (o->inherits("QGraphicsItem")) qWarning("Cannot add a QtQuick 1.0 item (%s) into a QtQuick 2.0 scene!", o->metaObject()->className()); else if (QQuickPointerHandler *pointerHandler = qmlobject_cast<QQuickPointerHandler *>(o)) { - Q_ASSERT(pointerHandler->parentItem() == that); - // Accept all buttons, and leave filtering to pointerEvent() and/or user JS, - // because there can be multiple handlers... - that->setAcceptedMouseButtons(Qt::AllButtons); - QQuickItemPrivate *p = QQuickItemPrivate::get(that); - p->extra.value().pointerHandlers.prepend(pointerHandler); + if (pointerHandler->parent() != that) { + qCDebug(lcHandlerParent) << "reparenting handler" << pointerHandler << ":" << pointerHandler->parent() << "->" << that; + pointerHandler->setParent(that); + } + QQuickItemPrivate::get(that)->addPointerHandler(pointerHandler); } else { QQuickWindow *thisWindow = qmlobject_cast<QQuickWindow *>(o); QQuickItem *item = that; @@ -8209,6 +8209,17 @@ bool QQuickItemPrivate::hasHoverHandlers() const return false; } +void QQuickItemPrivate::addPointerHandler(QQuickPointerHandler *h) +{ + Q_Q(QQuickItem); + // Accept all buttons, and leave filtering to pointerEvent() and/or user JS, + // because there can be multiple handlers... + q->setAcceptedMouseButtons(Qt::AllButtons); + auto &handlers = extra.value().pointerHandlers; + if (!handlers.contains(h)) + handlers.prepend(h); +} + #if QT_CONFIG(quick_shadereffect) QQuickItemLayer::QQuickItemLayer(QQuickItem *item) : m_item(item) diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h index 11b47114cf..4ca3a01d02 100644 --- a/src/quick/items/qquickitem_p.h +++ b/src/quick/items/qquickitem_p.h @@ -281,6 +281,7 @@ public: bool hasPointerHandlers() const; bool hasHoverHandlers() const; + void addPointerHandler(QQuickPointerHandler *h); // data property static void data_append(QQmlListProperty<QObject> *, QObject *); diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index a20150e3b9..b2fcfb4307 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -145,6 +145,7 @@ static QQmlPrivate::AutoParentResult qquickitem_autoParent(QObject *obj, QObject return QQmlPrivate::Parented; } } else if (QQuickPointerHandler *handler = qmlobject_cast<QQuickPointerHandler *>(obj)) { + QQuickItemPrivate::get(parentItem)->addPointerHandler(handler); handler->setParent(parent); return QQmlPrivate::Parented; } @@ -156,13 +157,14 @@ static QQmlPrivate::AutoParentResult qquickitem_autoParent(QObject *obj, QObject qCDebug(lcTransient) << win << "is transient for" << parentWindow; win->setTransientParent(parentWindow); return QQmlPrivate::Parented; - } else { - QQuickItem *item = qmlobject_cast<QQuickItem *>(obj); - if (item) { - // The parent of an Item inside a Window is actually the implicit content Item - item->setParentItem(parentWindow->contentItem()); - return QQmlPrivate::Parented; - } + } else if (QQuickItem *item = qmlobject_cast<QQuickItem *>(obj)) { + // The parent of an Item inside a Window is actually the implicit content Item + item->setParentItem(parentWindow->contentItem()); + return QQmlPrivate::Parented; + } else if (QQuickPointerHandler *handler = qmlobject_cast<QQuickPointerHandler *>(obj)) { + QQuickItemPrivate::get(parentWindow->contentItem())->addPointerHandler(handler); + handler->setParent(parentWindow->contentItem()); + return QQmlPrivate::Parented; } return QQmlPrivate::IncompatibleObject; } else if (qmlobject_cast<QQuickItem *>(obj)) { diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 4d4540bc36..dd7fbccff5 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -2082,6 +2082,8 @@ void QQuickText::resetMaximumLineCount() \code <b></b> - bold + <del></del> - strike out (removed content) + <s></s> - strike out (no longer accurate or no longer relevant content) <strong></strong> - bold <i></i> - italic <br> - new line diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index a09aa830fb..b5a68a2283 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -2246,13 +2246,14 @@ QQuickPointerEvent *QQuickWindowPrivate::queryPointerEventInstance(QQuickPointer { // Search for a matching reusable event object. for (QQuickPointerEvent *e : pointerEventInstances) { - // If device can generate native gestures (e.g. a trackpad), there might be two QQuickPointerEvents: - // QQuickPointerNativeGestureEvent and QQuickPointerTouchEvent. Use eventType to disambiguate. + // If device can generate native gestures (e.g. a trackpad), there might be multiple QQuickPointerEvents: + // QQuickPointerNativeGestureEvent, QQuickPointerScrollEvent, and QQuickPointerTouchEvent. + // Use eventType to disambiguate. #if QT_CONFIG(gestures) - if (eventType == QEvent::NativeGesture && !qobject_cast<QQuickPointerNativeGestureEvent*>(e)) + if ((eventType == QEvent::NativeGesture) != bool(e->asPointerNativeGestureEvent())) continue; #endif - if (eventType == QEvent::Wheel && !qobject_cast<QQuickPointerScrollEvent*>(e)) + if ((eventType == QEvent::Wheel) != bool(e->asPointerScrollEvent())) continue; // Otherwise we assume there's only one event type per device. // More disambiguation tests might need to be added above if that changes later. diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp index bd0698be6c..20286a03d5 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp @@ -156,10 +156,11 @@ void QSGSoftwareNinePatchNode::setTexture(QSGTexture *texture) QSGSoftwarePixmapTexture *pt = qobject_cast<QSGSoftwarePixmapTexture*>(texture); if (!pt) { qWarning() << "Image used with invalid texture format."; - return; + } else { + m_pixmap = pt->pixmap(); + markDirty(DirtyMaterial); } - m_pixmap = pt->pixmap(); - markDirty(DirtyMaterial); + delete texture; } void QSGSoftwareNinePatchNode::setBounds(const QRectF &bounds) diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp index b400473128..f5a41410ee 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp @@ -45,6 +45,7 @@ #include <private/qquickwindow_p.h> #include <QElapsedTimer> +#include <private/qquickanimatorcontroller_p.h> #include <private/qquickprofiler_p.h> #include <private/qsgsoftwarerenderer_p.h> #include <qpa/qplatformbackingstore.h> @@ -98,6 +99,8 @@ void QSGSoftwareRenderLoop::windowDestroyed(QQuickWindow *window) if (m_windows.size() == 0) { rc->invalidate(); } + + delete d->animationController; } void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window, bool isNewExpose) diff --git a/src/quick/util/qquickstyledtext.cpp b/src/quick/util/qquickstyledtext.cpp index 762d49f2d2..5e1aaf121e 100644 --- a/src/quick/util/qquickstyledtext.cpp +++ b/src/quick/util/qquickstyledtext.cpp @@ -50,6 +50,8 @@ QQuickStyledText supports few tags: <b></b> - bold + <del></del> - strike out (removed content) + <s></s> - strike out (no longer accurate or no longer relevant content) <strong></strong> - bold <i></i> - italic <br> - new line @@ -379,8 +381,16 @@ bool QQuickStyledTextPrivate::parseTag(const QChar *&ch, const QString &textIn, format.setFontWeight(QFont::Bold); return true; } - } else if (tag == QLatin1String("strong")) { - format.setFontWeight(QFont::Bold); + } else if (char0 == QLatin1Char('s')) { + if (tagLength == 1) { + format.setFontStrikeOut(true); + return true; + } else if (tag == QLatin1String("strong")) { + format.setFontWeight(QFont::Bold); + return true; + } + } else if (tag == QLatin1String("del")) { + format.setFontStrikeOut(true); return true; } else if (tag == QLatin1String("ol")) { List listItem; @@ -511,7 +521,13 @@ bool QQuickStyledTextPrivate::parseCloseTag(const QChar *&ch, const QString &tex return true; } else if (tag == QLatin1String("font")) { return true; - } else if (tag == QLatin1String("strong")) { + } else if (char0 == QLatin1Char('s')) { + if (tagLength == 1) { + return true; + } else if (tag == QLatin1String("strong")) { + return true; + } + } else if (tag == QLatin1String("del")) { return true; } else if (tag == QLatin1String("ol")) { if (!listStack.isEmpty()) { |