diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-03-26 01:00:11 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-04-09 10:08:41 +0200 |
commit | 2812184e1bb87cd94d2989162bc6ea954bb585c4 (patch) | |
tree | 25460548730e2ddc1f6f328d54e97d3fbfb49d21 /src/quick | |
parent | cd4a99a7ba92968bf88da9af2624bb738d71e726 (diff) | |
parent | bf205b45a29ba80d94df3b6bac5fec4c7cd79bf9 (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
src/qml/jsruntime/qv4executablecompilationunit.cpp
src/qml/jsruntime/qv4executablecompilationunit_p.h
src/qml/qml/qqmlobjectcreator.cpp
src/qml/qml/qqmlpropertycachecreator_p.h
src/qml/qml/qqmltypecompiler.cpp
src/qml/qml/qqmltypedata.cpp
tests/auto/qml/qmlformat/tst_qmlformat.cpp
tools/qmllint/scopetree.cpp
src/qml/qml/qqmlapplicationengine_p.h
Adjusted tools/qmllint/findunqualified.cpp to use newer API
Change-Id: Ibfb4678ca39d626d47527265e3c96e43313873d4
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/items/context2d/qquickcontext2d.cpp | 5 | ||||
-rw-r--r-- | src/quick/items/qquickevents.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/qquickflickable.cpp | 3 | ||||
-rw-r--r-- | src/quick/items/qquickitem.cpp | 11 | ||||
-rw-r--r-- | src/quick/items/qquickmousearea.cpp | 6 | ||||
-rw-r--r-- | src/quick/items/qquickmultipointtoucharea.cpp | 4 | ||||
-rw-r--r-- | src/quick/items/qquickpincharea.cpp | 8 | ||||
-rw-r--r-- | src/quick/items/qquickscreen_p.h | 2 | ||||
-rw-r--r-- | src/quick/items/qquicktableview.cpp | 19 | ||||
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 3 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgdefaultrendercontext.cpp | 2 | ||||
-rw-r--r-- | src/quick/util/qquickanimation.cpp | 20 |
12 files changed, 57 insertions, 28 deletions
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index 8361be7277..12a4ce32df 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -986,10 +986,11 @@ static QV4::ReturnedValue qt_create_image_data(qreal w, qreal h, QV4::ExecutionE pixelData->setPrototypeOf(p); if (image.isNull()) { - *pixelData->d()->image = QImage(w, h, QImage::Format_ARGB32); + *pixelData->d()->image = QImage(qRound(w), qRound(h), QImage::Format_ARGB32); pixelData->d()->image->fill(0x00000000); } else { - Q_ASSERT(image.width()== qRound(w * image.devicePixelRatioF()) && image.height() == qRound(h * image.devicePixelRatioF())); + // After qtbase 88e56d0932a3615231adf40d5ae033e742d72c33, the image size can be off by one. + Q_ASSERT(qAbs(image.width() - qRound(w * image.devicePixelRatioF())) <= 1 && qAbs(image.height() - qRound(h * image.devicePixelRatioF())) <= 1); *pixelData->d()->image = image.format() == QImage::Format_ARGB32 ? image : image.convertToFormat(QImage::Format_ARGB32); } diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp index 9469a9a06c..22b8877b9f 100644 --- a/src/quick/items/qquickevents.cpp +++ b/src/quick/items/qquickevents.cpp @@ -2171,7 +2171,7 @@ QTouchEvent *QQuickPointerTouchEvent::touchEventForItem(QQuickItem *item, bool i tpCopy.setPos(item->mapFromScene(tpCopy.scenePos())); tpCopy.setLastPos(item->mapFromScene(tpCopy.lastScenePos())); tpCopy.setStartPos(item->mapFromScene(tpCopy.startScenePos())); - tpCopy.setRect(item->mapRectFromScene(tpCopy.sceneRect())); + tpCopy.setEllipseDiameters(tpCopy.ellipseDiameters()); tpCopy.setVelocity(transformMatrix.mapVector(tpCopy.velocity()).toVector2D()); touchPoints << tpCopy; } diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index c7f641cf1f..c91a5ef92b 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -1897,6 +1897,9 @@ void QQuickFlickable::cancelFlick() void QQuickFlickablePrivate::data_append(QQmlListProperty<QObject> *prop, QObject *o) { + if (!prop || !prop->data) + return; + if (QQuickItem *i = qmlobject_cast<QQuickItem *>(o)) { i->setParentItem(static_cast<QQuickFlickablePrivate*>(prop->data)->contentItem); } else if (QQuickPointerHandler *pointerHandler = qmlobject_cast<QQuickPointerHandler *>(o)) { diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index a1f8fd35d8..cb1d3e224e 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -3977,6 +3977,9 @@ void QQuickItem::focusOutEvent(QFocusEvent * /*event*/) press events for an item. The event information is provided by the \a event parameter. + In order to receive mouse press events, \l acceptedMouseButtons() must + return the relevant mouse button. + \input item.qdocinc accepting-events */ void QQuickItem::mousePressEvent(QMouseEvent *event) @@ -3989,6 +3992,10 @@ void QQuickItem::mousePressEvent(QMouseEvent *event) move events for an item. The event information is provided by the \a event parameter. + In order to receive mouse movement events, the preceding mouse press event + must be accepted (by overriding \l mousePressEvent(), for example) and + \l acceptedMouseButtons() must return the relevant mouse button. + \input item.qdocinc accepting-events */ void QQuickItem::mouseMoveEvent(QMouseEvent *event) @@ -4001,6 +4008,10 @@ void QQuickItem::mouseMoveEvent(QMouseEvent *event) release events for an item. The event information is provided by the \a event parameter. + In order to receive mouse release events, the preceding mouse press event + must be accepted (by overriding \l mousePressEvent(), for example) and + \l acceptedMouseButtons() must return the relevant mouse button. + \input item.qdocinc accepting-events */ void QQuickItem::mouseReleaseEvent(QMouseEvent *event) diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp index fd2458494c..f54858e4eb 100644 --- a/src/quick/items/qquickmousearea.cpp +++ b/src/quick/items/qquickmousearea.cpp @@ -1063,6 +1063,12 @@ void QQuickMouseArea::itemChange(ItemChange change, const ItemChangeData &value) } setHovered(!d->hovered); } + if (d->pressed && (!isVisible())) { + // This happens when the mouse area sets itself disabled or hidden + // inside the press handler. In that case we should not keep the internal + // state as pressed, since we never became the mouse grabber. + ungrabMouse(); + } break; default: break; diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp index a854d97f7e..383718c979 100644 --- a/src/quick/items/qquickmultipointtoucharea.cpp +++ b/src/quick/items/qquickmultipointtoucharea.cpp @@ -789,7 +789,9 @@ void QQuickMultiPointTouchArea::updateTouchPoint(QQuickTouchPoint *dtp, const QT dtp->setPressure(p->pressure()); dtp->setRotation(p->rotation()); dtp->setVelocity(p->velocity()); - dtp->setArea(p->rect()); + QRectF area(QPointF(), p->ellipseDiameters()); + area.moveCenter(p->pos()); + dtp->setArea(area); dtp->setStartX(p->startPos().x()); dtp->setStartY(p->startPos().y()); dtp->setPreviousX(p->lastPos().x()); diff --git a/src/quick/items/qquickpincharea.cpp b/src/quick/items/qquickpincharea.cpp index f963bdf74f..0692a1da42 100644 --- a/src/quick/items/qquickpincharea.cpp +++ b/src/quick/items/qquickpincharea.cpp @@ -194,7 +194,7 @@ QQuickPinchAreaPrivate::~QQuickPinchAreaPrivate() */ /*! - \qmlsignal QtQuick::PinchArea::pinchStarted() + \qmlsignal QtQuick::PinchArea::pinchStarted(PinchEvent pinch) This signal is emitted when the pinch area detects that a pinch gesture has started: two touch points (fingers) have been detected, and they have moved @@ -213,7 +213,7 @@ QQuickPinchAreaPrivate::~QQuickPinchAreaPrivate() */ /*! - \qmlsignal QtQuick::PinchArea::pinchUpdated() + \qmlsignal QtQuick::PinchArea::pinchUpdated(PinchEvent pinch) This signal is emitted when the pinch area detects that a pinch gesture has changed. @@ -225,7 +225,7 @@ QQuickPinchAreaPrivate::~QQuickPinchAreaPrivate() */ /*! - \qmlsignal QtQuick::PinchArea::pinchFinished() + \qmlsignal QtQuick::PinchArea::pinchFinished(PinchEvent pinch) This signal is emitted when the pinch area detects that a pinch gesture has finished. @@ -235,7 +235,7 @@ QQuickPinchAreaPrivate::~QQuickPinchAreaPrivate() */ /*! - \qmlsignal QtQuick::PinchArea::smartZoom() + \qmlsignal QtQuick::PinchArea::smartZoom(PinchEvent pinch) \since 5.5 This signal is emitted when the pinch area detects the smart zoom gesture. diff --git a/src/quick/items/qquickscreen_p.h b/src/quick/items/qquickscreen_p.h index dc1c820309..eade79e683 100644 --- a/src/quick/items/qquickscreen_p.h +++ b/src/quick/items/qquickscreen_p.h @@ -78,9 +78,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickScreenInfo : public QObject Q_PROPERTY(qreal logicalPixelDensity READ logicalPixelDensity NOTIFY logicalPixelDensityChanged) Q_PROPERTY(qreal pixelDensity READ pixelDensity NOTIFY pixelDensityChanged) Q_PROPERTY(qreal devicePixelRatio READ devicePixelRatio NOTIFY devicePixelRatioChanged) - // TODO Qt 6 Rename primaryOrientation to orientation Q_PROPERTY(Qt::ScreenOrientation primaryOrientation READ primaryOrientation NOTIFY primaryOrientationChanged) - // TODO Qt 6 Remove this orientation -> incomplete device orientation -> better use OrientationSensor Q_PROPERTY(Qt::ScreenOrientation orientation READ orientation NOTIFY orientationChanged) Q_PROPERTY(int virtualX READ virtualX NOTIFY virtualXChanged REVISION(2, 3)) diff --git a/src/quick/items/qquicktableview.cpp b/src/quick/items/qquicktableview.cpp index 3548d20706..5adfd20bf0 100644 --- a/src/quick/items/qquicktableview.cpp +++ b/src/quick/items/qquicktableview.cpp @@ -1,4 +1,4 @@ -/**************************************************************************** +/**************************************************************************** ** ** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ @@ -193,8 +193,10 @@ \qmlproperty int QtQuick::TableView::rows \readonly - This property holds the number of rows in the table. This is - equal to the number of rows in the model. + This property holds the number of rows in the table. + + \note \a rows is usually equal to the number of rows in the model, but can + temporarily differ until all pending model changes have been processed. This property is read only. */ @@ -203,9 +205,12 @@ \qmlproperty int QtQuick::TableView::columns \readonly - This property holds the number of columns in the table. This is - equal to the number of columns in the model. If the model is - a list, columns will be \c 1. + This property holds the number of rows in the table. + + \note \a columns is usually equal to the number of columns in the model, but + can temporarily differ until all pending model changes have been processed. + + If the model is a list, columns will be \c 1. This property is read only. */ @@ -549,6 +554,8 @@ QQuickTableViewPrivate::~QQuickTableViewPrivate() QString QQuickTableViewPrivate::tableLayoutToString() const { + if (loadedItems.isEmpty()) + return QLatin1String("table is empty!"); return QString(QLatin1String("table cells: (%1,%2) -> (%3,%4), item count: %5, table rect: %6,%7 x %8,%9")) .arg(leftColumn()).arg(topRow()) .arg(rightColumn()).arg(bottomRow()) diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index acf6fd68c8..4874af44ed 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -976,8 +976,7 @@ void QQuickWindowPrivate::translateTouchEvent(QTouchEvent *touchEvent) QList<QTouchEvent::TouchPoint> touchPoints = touchEvent->touchPoints(); for (int i = 0; i < touchPoints.count(); ++i) { QTouchEvent::TouchPoint &touchPoint = touchPoints[i]; - - touchPoint.setSceneRect(touchPoint.rect()); + touchPoint.setScenePos(touchPoint.pos()); touchPoint.setStartScenePos(touchPoint.startPos()); touchPoint.setLastScenePos(touchPoint.lastPos()); } diff --git a/src/quick/scenegraph/qsgdefaultrendercontext.cpp b/src/quick/scenegraph/qsgdefaultrendercontext.cpp index 14314b2c94..ed2f8c313f 100644 --- a/src/quick/scenegraph/qsgdefaultrendercontext.cpp +++ b/src/quick/scenegraph/qsgdefaultrendercontext.cpp @@ -242,8 +242,6 @@ void QSGDefaultRenderContext::beginNextRhiFrame(QSGRenderer *renderer, QRhiRende RenderPassCallback mainPassRecordingEnd, void *callbackUserData) { - Q_ASSERT(!m_currentFrameCommandBuffer); - renderer->setRenderTarget(rt); renderer->setRenderPassDescriptor(rp); renderer->setCommandBuffer(cb); diff --git a/src/quick/util/qquickanimation.cpp b/src/quick/util/qquickanimation.cpp index 90c725a67f..e5e25d141b 100644 --- a/src/quick/util/qquickanimation.cpp +++ b/src/quick/util/qquickanimation.cpp @@ -176,11 +176,8 @@ void QQuickAbstractAnimationPrivate::commence() animationInstance = new QQuickAnimatorProxyJob(animationInstance, q); animationInstance->addAnimationChangeListener(this, QAbstractAnimationJob::Completion); } + emit q->started(); animationInstance->start(); - if (animationInstance->isStopped()) { - running = false; - emit q->stopped(); - } } } @@ -287,10 +284,8 @@ void QQuickAbstractAnimation::setRunning(bool r) d->animationInstance->setLoopCount(d->animationInstance->currentLoop() + d->loopCount); supressStart = true; //we want the animation to continue, rather than restart } - if (!supressStart) { + if (!supressStart) d->commence(); - emit started(); - } } else { if (d->paused) { d->paused = false; //reset paused state to false when stopped @@ -308,7 +303,16 @@ void QQuickAbstractAnimation::setRunning(bool r) } } - emit runningChanged(d->running); + + if (r == d->running) { + // This might happen if we start an animation with 0 duration: This will result in that + // commence() will emit started(), and then when it starts it will call setCurrentTime(0), + // (which is both start and end time of the animation), so it will also end up calling + // setRunning(false) (recursively) and stop the animation. + // Therefore, the state of d->running will in that case be different than r if we are back in + // the root stack frame of the recursive calls to setRunning() + emit runningChanged(d->running); + } } /*! |