summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-10-05 19:32:12 +0200
committerLiang Qi <liang.qi@qt.io>2016-10-05 19:32:12 +0200
commitfff4477661ae240c43088fa6d9069ccf969dbee8 (patch)
treed654a5f841cc6abe758c8626bbf51be6bdcdea26
parent3a205800c6ea0a88ae2ab35edabf6883e54a334b (diff)
parent59e48836e207aff52b2727cc4f3733209475e8bb (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp4
-rw-r--r--src/qml/memory/qv4mm.cpp9
-rw-r--r--src/quick/items/context2d/qquickcontext2dtexture.cpp12
-rw-r--r--src/quick/items/qquickpositioners.cpp8
-rw-r--r--src/quick/items/qquickrectangle.cpp2
-rw-r--r--src/quick/util/qquickimageprovider.cpp2
-rw-r--r--src/quick/util/qquickpixmapcache.cpp1
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp45
8 files changed, 70 insertions, 13 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index ea3cfabf4d..2c9fc8f9dd 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -1045,6 +1045,10 @@ void QObjectWrapper::destroyObject(bool lastCall)
delete h->object;
else
h->object->deleteLater();
+ } else {
+ // If the object is C++-owned, we still have to release the weak reference we have
+ // to it.
+ ddata->jsWrapper.clear();
}
}
}
diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp
index 3ebe074ae3..990f6477d7 100644
--- a/src/qml/memory/qv4mm.cpp
+++ b/src/qml/memory/qv4mm.cpp
@@ -46,7 +46,7 @@
#include "PageAllocation.h"
#include "StdLibExtras.h"
-#include <QTime>
+#include <QElapsedTimer>
#include <QMap>
#include <QScopedValueRollback>
@@ -568,18 +568,17 @@ void MemoryManager::runGC()
} else {
const size_t totalMem = getAllocatedMem();
- QTime t;
+ QElapsedTimer t;
t.start();
mark();
- int markTime = t.elapsed();
- t.restart();
+ qint64 markTime = t.restart();
const size_t usedBefore = getUsedMem();
const size_t largeItemsBefore = getLargeItemsMem();
int chunksBefore = m_d->heapChunks.size();
sweep();
const size_t usedAfter = getUsedMem();
const size_t largeItemsAfter = getLargeItemsMem();
- int sweepTime = t.elapsed();
+ qint64 sweepTime = t.elapsed();
qDebug() << "========== GC ==========";
qDebug() << "Marked object in" << markTime << "ms.";
diff --git a/src/quick/items/context2d/qquickcontext2dtexture.cpp b/src/quick/items/context2d/qquickcontext2dtexture.cpp
index f3513f447a..375f537b9b 100644
--- a/src/quick/items/context2d/qquickcontext2dtexture.cpp
+++ b/src/quick/items/context2d/qquickcontext2dtexture.cpp
@@ -544,6 +544,9 @@ QPaintDevice* QQuickContext2DFBOTexture::beginPainting()
{
QQuickContext2DTexture::beginPainting();
+ const qreal devicePixelRatio = (m_item && m_item->window()) ?
+ m_item->window()->effectiveDevicePixelRatio() : qApp->devicePixelRatio();
+
if (m_canvasWindow.size().isEmpty()) {
delete m_fbo;
delete m_multisampledFbo;
@@ -558,7 +561,7 @@ QPaintDevice* QQuickContext2DFBOTexture::beginPainting()
delete m_paint_device;
m_paint_device = 0;
- m_fboSize = npotAdjustedSize(m_canvasWindow.size());
+ m_fboSize = npotAdjustedSize(m_canvasWindow.size() * devicePixelRatio);
m_canvasWindowChanged = false;
if (doMultisampling()) {
@@ -596,6 +599,7 @@ QPaintDevice* QQuickContext2DFBOTexture::beginPainting()
QOpenGLPaintDevice *gl_device = new QOpenGLPaintDevice(m_fbo->size());
gl_device->setPaintFlipped(true);
gl_device->setSize(m_fbo->size());
+ gl_device->setDevicePixelRatio(devicePixelRatio);
m_paint_device = gl_device;
}
@@ -700,8 +704,12 @@ QPaintDevice* QQuickContext2DImageTexture::beginPainting()
if (m_canvasWindow.size().isEmpty())
return 0;
+ const qreal devicePixelRatio = (m_item && m_item->window()) ?
+ m_item->window()->effectiveDevicePixelRatio() : qApp->devicePixelRatio();
+
if (m_canvasWindowChanged) {
- m_image = QImage(m_canvasWindow.size(), QImage::Format_ARGB32_Premultiplied);
+ m_image = QImage(m_canvasWindow.size() * devicePixelRatio, QImage::Format_ARGB32_Premultiplied);
+ m_image.setDevicePixelRatio(devicePixelRatio);
m_image.fill(0x00000000);
m_canvasWindowChanged = false;
}
diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp
index 38e89e78eb..e22427ca49 100644
--- a/src/quick/items/qquickpositioners.cpp
+++ b/src/quick/items/qquickpositioners.cpp
@@ -872,7 +872,7 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem)
the item that is being added. See the \l ViewTransition documentation for more details
and examples on using these transitions.
- \note This transition is not applied to the items that already part of the positioner
+ \note This transition is not applied to the items that are already part of the positioner
at the time of its creation. In this case, the \l populate transition is applied instead.
\sa populate, ViewTransition, {Qt Quick Examples - Positioners}
@@ -1039,7 +1039,7 @@ void QQuickColumn::reportConflictingAnchors()
the item that is being added. See the \l ViewTransition documentation for more details
and examples on using these transitions.
- \note This transition is not applied to the items that already part of the positioner
+ \note This transition is not applied to the items that are already part of the positioner
at the time of its creation. In this case, the \l populate transition is applied instead.
\sa populate, ViewTransition, {Qt Quick Examples - Positioners}
@@ -1307,7 +1307,7 @@ void QQuickRow::reportConflictingAnchors()
the item that is being added. See the \l ViewTransition documentation for more details
and examples on using these transitions.
- \note This transition is not applied to the items that already part of the positioner
+ \note This transition is not applied to the items that are already part of the positioner
at the time of its creation. In this case, the \l populate transition is applied instead.
\sa populate, ViewTransition, {Qt Quick Examples - Positioners}
@@ -1882,7 +1882,7 @@ void QQuickGrid::reportConflictingAnchors()
the item that is being added. See the \l ViewTransition documentation for more details
and examples on using these transitions.
- \note This transition is not applied to the items that already part of the positioner
+ \note This transition is not applied to the items that are already part of the positioner
at the time of its creation. In this case, the \l populate transition is applied instead.
\sa populate, ViewTransition, {Qt Quick Examples - Positioners}
diff --git a/src/quick/items/qquickrectangle.cpp b/src/quick/items/qquickrectangle.cpp
index 74ca0f482a..05ff0c0fda 100644
--- a/src/quick/items/qquickrectangle.cpp
+++ b/src/quick/items/qquickrectangle.cpp
@@ -366,7 +366,7 @@ QQuickPen *QQuickRectangle::border()
The gradient to use to fill the rectangle.
This property allows for the construction of simple vertical gradients.
- Other gradients may by formed by adding rotation to the rectangle.
+ Other gradients may be formed by adding rotation to the rectangle.
\div {class="float-left"}
\inlineimage declarative-rect_gradient.png
diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp
index f6a90cb70a..0c245d2b23 100644
--- a/src/quick/util/qquickimageprovider.cpp
+++ b/src/quick/util/qquickimageprovider.cpp
@@ -187,6 +187,8 @@ QString QQuickImageResponse::errorString() const
This method is used to communicate that the response is no longer required by the engine.
It may be reimplemented to cancel a request in the provider side, however, it is not mandatory.
+
+ A cancelled QQuickImageResponse still needs to emit finished().
*/
void QQuickImageResponse::cancel()
{
diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp
index 6dee84b005..50b867125e 100644
--- a/src/quick/util/qquickpixmapcache.cpp
+++ b/src/quick/util/qquickpixmapcache.cpp
@@ -590,7 +590,6 @@ void QQuickPixmapReader::processJobs()
if (asyncResponse) {
asyncResponses.remove(asyncResponse);
asyncResponse->cancel();
- asyncResponse->deleteLater();
}
}
PIXMAP_PROFILE(pixmapStateChanged<QQuickProfiler::PixmapLoadingError>(job->url));
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
index 339e8946e8..d0f015324c 100644
--- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
@@ -70,6 +70,7 @@ private slots:
void returnToBounds();
void returnToBounds_data();
void wheel();
+ void trackpad();
void movingAndFlicking();
void movingAndFlicking_data();
void movingAndDragging();
@@ -785,6 +786,50 @@ void tst_qquickflickable::wheel()
QCOMPARE(flick->property("movementsAfterEnd").value<int>(), 0); // QTBUG-55886
}
+void tst_qquickflickable::trackpad()
+{
+ QScopedPointer<QQuickView> window(new QQuickView);
+ window->setSource(testFileUrl("wheel.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickFlickable *flick = window->rootObject()->findChild<QQuickFlickable*>("flick");
+ QVERIFY(flick != 0);
+ QSignalSpy moveEndSpy(flick, SIGNAL(movementEnded()));
+ QPoint pos(200, 200);
+
+ {
+ QWheelEvent event(pos, window->mapToGlobal(pos), QPoint(0,-100), QPoint(0,-120), -120, Qt::Vertical, Qt::NoButton, Qt::NoModifier, Qt::ScrollBegin);
+ event.setAccepted(false);
+ QGuiApplication::sendEvent(window.data(), &event);
+ }
+
+ QTRY_VERIFY(flick->contentY() > 0);
+ QCOMPARE(flick->contentX(), qreal(0));
+
+ flick->setContentY(0);
+ QCOMPARE(flick->contentY(), qreal(0));
+
+ {
+ QWheelEvent event(pos, window->mapToGlobal(pos), QPoint(-100,0), QPoint(-120,0), -120, Qt::Horizontal, Qt::NoButton, Qt::NoModifier, Qt::ScrollUpdate);
+ event.setAccepted(false);
+ QGuiApplication::sendEvent(window.data(), &event);
+ }
+
+ QTRY_VERIFY(flick->contentX() > 0);
+ QCOMPARE(flick->contentY(), qreal(0));
+
+ {
+ QWheelEvent event(pos, window->mapToGlobal(pos), QPoint(0,0), QPoint(0,0), 0, Qt::Horizontal, Qt::NoButton, Qt::NoModifier, Qt::ScrollEnd);
+ event.setAccepted(false);
+ QGuiApplication::sendEvent(window.data(), &event);
+ }
+
+ QTRY_COMPARE(moveEndSpy.count(), 1); // QTBUG-55871
+ QCOMPARE(flick->property("movementsAfterEnd").value<int>(), 0); // QTBUG-55886
+}
+
void tst_qquickflickable::movingAndFlicking_data()
{
QTest::addColumn<bool>("verticalEnabled");