From 2bb382f9c276a1dc1258148c156222be3576aff5 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 25 Sep 2019 11:47:47 +0200 Subject: Make tst_qquickcanvasitem significant again; fix image size rounding - the test items must be visible, so that waitForRendering() works - arcTo::test_paint tried to render an out-of-bounds arc, which resulted in rendering nothing. Now renders within the 100x100 canvas. - painted() is not emitted the first time the Canvas is rendered. - Canvas.save() saves relative to the directory from which the test is run, while Canvas.loadImage() loads relative to the test data directory in this autotest (other tests are loading red.png for example). So we need to use absolute paths to test loading and saving in the directory where the executable is. - canvas.getContext('2d').getImageData(8.5, 8.5, 8.5, 8.5) now triggers different rounding behavior in QRectF::toRect(), after qtbase 88e56d0932a3615231adf40d5ae033e742d72c33: it becomes QRect(9,9 8x8). The assert in qt_create_image_data() needs to accommodate that. - Fixed another pedantic warning in qt_create_image_data a few lines above: if it creates the image itself, it needs to round the qreal width and height values. This reverts commit a23ee5c0de0d91859e1e76e64073861347dd9861 and amends 424cfef3cc3c140df51905713fa3849562bc494d and d142b2d212ea09a7919a0a2761ee9c04d5c9bda8. Task-number: QTBUG-41043 Change-Id: I825c2c5a2bbc8d5324c3ba41a681aa68bc25a159 Reviewed-by: Shawn Rutledge --- src/quick/items/context2d/qquickcontext2d.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index 54cda72a36..14fa07099f 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); } -- cgit v1.2.3 From 92fc8e4cb82aaa0e2996e38d8e16317e5cb8f972 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Wed, 12 Feb 2020 15:48:02 +0100 Subject: PinchArea: document the pinch parameter for its signals The parameter was described in the documentation but missing from the signatures. Change-Id: Ie2718c9f2ac945ac7c8ea1555d097b426d9fba2a Reviewed-by: Shawn Rutledge --- src/quick/items/qquickpincharea.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickpincharea.cpp b/src/quick/items/qquickpincharea.cpp index 3d4f195380..2301a5c26e 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 @@ -215,7 +215,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. @@ -229,7 +229,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. @@ -241,7 +241,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. -- cgit v1.2.3 From d94bb1f6795302ef6eec795dd3ad92d60bd2aa4d Mon Sep 17 00:00:00 2001 From: Nick Shaforostov Date: Wed, 8 May 2019 11:54:00 +0200 Subject: Flickable: add nullptr check (crash seen only in release mode on windows) Change-Id: I2ac42ded0c2ed4dc3937a57f69109f10b19f9cc7 Reviewed-by: Shawn Rutledge --- src/quick/items/qquickflickable.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/quick') diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 52f7c29aa4..445fa0215b 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -1909,6 +1909,9 @@ void QQuickFlickable::cancelFlick() void QQuickFlickablePrivate::data_append(QQmlListProperty *prop, QObject *o) { + if (!prop || !prop->data) + return; + if (QQuickItem *i = qmlobject_cast(o)) { i->setParentItem(static_cast(prop->data)->contentItem); } else if (QQuickPointerHandler *pointerHandler = qmlobject_cast(o)) { -- cgit v1.2.3