aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2017-11-13 13:30:20 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2017-11-13 14:09:41 +0100
commit29521913732704306b7db824ac9ce4be461bffc8 (patch)
treed834bd3d78a833bf767c4ba813e2d838d12dd4f2
parent7853634a1134a2b4b470a6d2c8b5da1610105d51 (diff)
parent6990ae6c1bad32952e371fa72bee65a7af11c313 (diff)
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts: src/quick/items/qquickwindow.cpp src/quick/items/qquickwindow_p.h tests/auto/quick/quick.pro Change-Id: Ia12f20e95fb151bbbc75dbf187364a924cd0bc7a
-rw-r--r--examples/quick/demos/photosurface/photosurface.qml4
-rw-r--r--src/qml/qml/qqmltypeloader.cpp10
-rw-r--r--src/qml/qml/qqmltypeloader_p.h1
-rw-r--r--src/quick/items/qquickflickable.cpp16
-rw-r--r--src/quick/items/qquickitemview.cpp27
-rw-r--r--src/quick/items/qquickopenglshadereffect.cpp2
-rw-r--r--src/quick/items/qquickwindow.cpp39
-rw-r--r--src/quick/items/qquickwindow_p.h1
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h2
-rw-r--r--src/quick/util/qquickanimatorcontroller.cpp4
-rw-r--r--src/quickwidgets/qquickwidget.cpp9
-rw-r--r--tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp6
-rw-r--r--tests/auto/quick/qquicklistview/data/qtbug63974.qml34
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp58
-rw-r--r--tests/auto/quick/qquickshadereffect/tst_qquickshadereffect.cpp8
-rw-r--r--tests/auto/quick/quick.pro2
-rw-r--r--tests/auto/quickwidgets/qquickwidget/BLACKLIST2
-rw-r--r--tests/auto/quickwidgets/qquickwidget/data/enterleave.qml12
-rw-r--r--tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp25
19 files changed, 214 insertions, 48 deletions
diff --git a/examples/quick/demos/photosurface/photosurface.qml b/examples/quick/demos/photosurface/photosurface.qml
index 8057bb8400..5d1445d776 100644
--- a/examples/quick/demos/photosurface/photosurface.qml
+++ b/examples/quick/demos/photosurface/photosurface.qml
@@ -181,7 +181,7 @@ Window {
radius: 2
antialiasing: true
height: flick.height * (flick.height / flick.contentHeight) - (width - anchors.margins) * 2
- y: flick.contentY * (flick.height / flick.contentHeight)
+ y: (flick.contentY - flick.originY) * (flick.height / flick.contentHeight)
NumberAnimation on opacity { id: vfade; to: 0; duration: 500 }
onYChanged: { opacity = 1.0; scrollFadeTimer.restart() }
}
@@ -197,7 +197,7 @@ Window {
radius: 2
antialiasing: true
width: flick.width * (flick.width / flick.contentWidth) - (height - anchors.margins) * 2
- x: flick.contentX * (flick.width / flick.contentWidth)
+ x: (flick.contentX - flick.originY) * (flick.width / flick.contentWidth)
NumberAnimation on opacity { id: hfade; to: 0; duration: 500 }
onXChanged: { opacity = 1.0; scrollFadeTimer.restart() }
}
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index b9d6c521de..8e9f57f661 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -316,7 +316,8 @@ Returns true if the status is WaitingForDependencies.
*/
bool QQmlDataBlob::isWaiting() const
{
- return status() == WaitingForDependencies;
+ return status() == WaitingForDependencies ||
+ status() == ResolvingDependencies;
}
/*!
@@ -608,6 +609,7 @@ The default implementation does nothing.
*/
void QQmlDataBlob::allDependenciesDone()
{
+ m_data.setStatus(QQmlDataBlob::ResolvingDependencies);
}
/*!
@@ -2499,6 +2501,8 @@ void QQmlTypeData::continueLoadFromIR()
void QQmlTypeData::allDependenciesDone()
{
+ QQmlTypeLoader::Blob::allDependenciesDone();
+
if (!m_typesResolved) {
// Check that all imports were resolved
QList<QQmlError> errors;
@@ -2618,6 +2622,10 @@ void QQmlTypeData::resolveTypes()
if (ref.type.isCompositeSingleton()) {
ref.typeData = typeLoader()->getType(ref.type.sourceUrl());
+ if (ref.typeData->status() == QQmlDataBlob::ResolvingDependencies) {
+ // TODO: give an error message? If so, we should record and show the path of the cycle.
+ continue;
+ }
addDependency(ref.typeData);
ref.prefix = csRef.prefix;
diff --git a/src/qml/qml/qqmltypeloader_p.h b/src/qml/qml/qqmltypeloader_p.h
index ef63e02b4f..22ac61968f 100644
--- a/src/qml/qml/qqmltypeloader_p.h
+++ b/src/qml/qml/qqmltypeloader_p.h
@@ -98,6 +98,7 @@ public:
Null, // Prior to QQmlTypeLoader::load()
Loading, // Prior to data being received and dataReceived() being called
WaitingForDependencies, // While there are outstanding addDependency()s
+ ResolvingDependencies, // While resolving outstanding dependencies, to detect cycles
Complete, // Finished
Error // Error
};
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index 2f639af790..ae5bdc3083 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -725,7 +725,19 @@ QQuickFlickable::~QQuickFlickable()
These properties hold the surface coordinate currently at the top-left
corner of the Flickable. For example, if you flick an image up 100 pixels,
- \c contentY will be 100.
+ \c contentY will increase by 100.
+
+ \note If you flick back to the origin (the top-left corner), after the
+ rebound animation, \c contentX will settle to the same value as \c originX,
+ and \c contentY to \c originY. These are usually (0,0), however ListView
+ and GridView may have an arbitrary origin due to delegate size variation,
+ or item insertion/removal outside the visible region. So if you want to
+ implement something like a vertical scrollbar, one way is to use
+ \c {y: (contentY - originY) * (height / contentHeight)}
+ for the position; another way is to use the normalized values in
+ \l {QtQuick::Flickable::visibleArea}{visibleArea}.
+
+ \sa originX, originY
*/
qreal QQuickFlickable::contentX() const
{
@@ -2152,6 +2164,8 @@ void QQuickFlickable::setRightMargin(qreal m)
This is usually (0,0), however ListView and GridView may have an arbitrary
origin due to delegate size variation, or item insertion/removal outside
the visible region.
+
+ \sa contentX, contentY
*/
qreal QQuickFlickable::originY() const
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index 478499e209..c203f389ae 100644
--- a/src/quick/items/qquickitemview.cpp
+++ b/src/quick/items/qquickitemview.cpp
@@ -952,11 +952,16 @@ void QQuickItemViewPrivate::positionViewAtIndex(int index, int mode)
item = visibleItem(idx);
}
if (item) {
+ const bool stickyHeader = hasStickyHeader();
+ const bool stickyFooter = hasStickyFooter();
+ const qreal stickyHeaderSize = stickyHeader ? headerSize() : 0;
+ const qreal stickyFooterSize = stickyFooter ? footerSize() : 0;
+
const qreal itemPos = item->position();
switch (mode) {
case QQuickItemView::Beginning:
pos = itemPos;
- if (header && (index < 0 || hasStickyHeader()))
+ if (header && (index < 0 || stickyHeader))
pos -= headerSize();
break;
case QQuickItemView::Center:
@@ -964,23 +969,23 @@ void QQuickItemViewPrivate::positionViewAtIndex(int index, int mode)
break;
case QQuickItemView::End:
pos = itemPos - viewSize + item->size();
- if (footer && (index >= modelCount || hasStickyFooter()))
+ if (footer && (index >= modelCount || stickyFooter))
pos += footerSize();
break;
case QQuickItemView::Visible:
- if (itemPos > pos + viewSize)
- pos = itemPos - viewSize + item->size();
- else if (item->endPosition() <= pos)
- pos = itemPos;
+ if (itemPos > pos + viewSize - stickyFooterSize)
+ pos = item->endPosition() - viewSize + stickyFooterSize;
+ else if (item->endPosition() <= pos - stickyHeaderSize)
+ pos = itemPos - stickyHeaderSize;
break;
case QQuickItemView::Contain:
- if (item->endPosition() >= pos + viewSize)
- pos = itemPos - viewSize + item->size();
- if (itemPos < pos)
- pos = itemPos;
+ if (item->endPosition() >= pos + viewSize + stickyFooterSize)
+ pos = itemPos - viewSize + item->size() + stickyFooterSize;
+ if (itemPos - stickyHeaderSize < pos)
+ pos = itemPos - stickyHeaderSize;
break;
case QQuickItemView::SnapPosition:
- pos = itemPos - highlightRangeStart;
+ pos = itemPos - highlightRangeStart - stickyHeaderSize;
break;
}
pos = qMin(pos, maxExtent);
diff --git a/src/quick/items/qquickopenglshadereffect.cpp b/src/quick/items/qquickopenglshadereffect.cpp
index c3e0ba05bd..94a5b6a646 100644
--- a/src/quick/items/qquickopenglshadereffect.cpp
+++ b/src/quick/items/qquickopenglshadereffect.cpp
@@ -896,7 +896,7 @@ QSGNode *QQuickOpenGLShaderEffect::handleUpdatePaintNode(QSGNode *oldNode, QQuic
bool geometryUsesTextureSubRect = false;
if (m_supportsAtlasTextures && material->textureProviders.size() == 1) {
QSGTextureProvider *provider = material->textureProviders.at(0);
- if (provider->texture()) {
+ if (provider && provider->texture()) {
srcRect = provider->texture()->normalizedTextureSubRect();
geometryUsesTextureSubRect = true;
}
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 143c76cb1b..73a594b281 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -843,11 +843,12 @@ void QQuickWindowPrivate::removeGrabber(QQuickItem *grabber, bool mouse, bool to
bool ungrab = false;
const auto touchDevices = QQuickPointerDevice::touchDevices();
for (auto device : touchDevices) {
- auto pointerEvent = pointerEventInstance(device);
- for (int i = 0; i < pointerEvent->pointCount(); ++i) {
- if (pointerEvent->point(i)->exclusiveGrabber() == grabber) {
- pointerEvent->point(i)->setGrabberItem(nullptr);
- ungrab = true;
+ if (auto pointerEvent = queryPointerEventInstance(device)) {
+ for (int i = 0; i < pointerEvent->pointCount(); ++i) {
+ if (pointerEvent->point(i)->exclusiveGrabber() == grabber) {
+ pointerEvent->point(i)->setGrabberItem(nullptr);
+ ungrab = true;
+ }
}
}
}
@@ -1312,6 +1313,8 @@ QQuickWindow::~QQuickWindow()
delete d->dragGrabber; d->dragGrabber = 0;
#endif
delete d->contentItem; d->contentItem = 0;
+ qDeleteAll(d->pointerEventInstances);
+ d->pointerEventInstances.clear();
d->renderJobMutex.lock();
qDeleteAll(d->beforeSynchronizingJobs);
@@ -1513,14 +1516,15 @@ QQuickItem *QQuickWindow::mouseGrabberItem() const
Q_D(const QQuickWindow);
if (d->touchMouseId != -1 && d->touchMouseDevice) {
- QQuickPointerEvent *event = d->pointerEventInstance(d->touchMouseDevice);
- auto point = event->pointById(d->touchMouseId);
- return point ? point->grabberItem() : nullptr;
+ if (QQuickPointerEvent *event = d->queryPointerEventInstance(d->touchMouseDevice)) {
+ auto point = event->pointById(d->touchMouseId);
+ return point ? point->grabberItem() : nullptr;
+ }
+ } else if (QQuickPointerEvent *event = d->queryPointerEventInstance(QQuickPointerDevice::genericMouseDevice())) {
+ Q_ASSERT(event->pointCount());
+ return event->point(0)->grabberItem();
}
-
- QQuickPointerEvent *event = d->pointerEventInstance(QQuickPointerDevice::genericMouseDevice());
- Q_ASSERT(event->pointCount());
- return event->point(0)->grabberItem();
+ return nullptr;
}
@@ -2204,7 +2208,7 @@ void QQuickWindowPrivate::flushFrameSynchronousEvents()
}
}
-QQuickPointerEvent *QQuickWindowPrivate::pointerEventInstance(QQuickPointerDevice *device, QEvent::Type eventType) const
+QQuickPointerEvent *QQuickWindowPrivate::queryPointerEventInstance(QQuickPointerDevice *device, QEvent::Type eventType) const
{
// Search for a matching reusable event object.
for (QQuickPointerEvent *e : pointerEventInstances) {
@@ -2217,9 +2221,14 @@ QQuickPointerEvent *QQuickWindowPrivate::pointerEventInstance(QQuickPointerDevic
if (e->device() == device)
return e;
}
+ return nullptr;
+}
- // Not found: we have to create a suitable event instance.
- QQuickPointerEvent *ev = nullptr;
+QQuickPointerEvent *QQuickWindowPrivate::pointerEventInstance(QQuickPointerDevice *device, QEvent::Type eventType) const
+{
+ QQuickPointerEvent *ev = queryPointerEventInstance(device, eventType);
+ if (ev)
+ return ev;
QQuickWindow *q = const_cast<QQuickWindow*>(q_func());
switch (device->type()) {
case QQuickPointerDevice::Mouse:
diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h
index 2d7b81cec8..b17fdf7a49 100644
--- a/src/quick/items/qquickwindow_p.h
+++ b/src/quick/items/qquickwindow_p.h
@@ -167,6 +167,7 @@ public:
// the device-specific event instances which are reused during event delivery
mutable QVector<QQuickPointerEvent *> pointerEventInstances;
+ QQuickPointerEvent *queryPointerEventInstance(QQuickPointerDevice *device, QEvent::Type eventType = QEvent::None) const;
QQuickPointerEvent *pointerEventInstance(QQuickPointerDevice *device, QEvent::Type eventType = QEvent::None) const;
// delivery of pointer events:
diff --git a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h
index c68a933384..f20c2cf977 100644
--- a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h
+++ b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h
@@ -104,7 +104,7 @@ private:
QRegion m_dirtyRegion;
QRegion m_obscuredRegion;
- bool m_isOpaque;
+ bool m_isOpaque = false;
QSGSoftwareRenderableNodeUpdater *m_nodeUpdater;
};
diff --git a/src/quick/util/qquickanimatorcontroller.cpp b/src/quick/util/qquickanimatorcontroller.cpp
index 3f7347c01d..5cf8051922 100644
--- a/src/quick/util/qquickanimatorcontroller.cpp
+++ b/src/quick/util/qquickanimatorcontroller.cpp
@@ -123,8 +123,10 @@ static void qquickanimator_sync_before_start(QAbstractAnimationJob *job)
void QQuickAnimatorController::beforeNodeSync()
{
- for (const QSharedPointer<QAbstractAnimationJob> &toStop : qAsConst(m_rootsPendingStop))
+ for (const QSharedPointer<QAbstractAnimationJob> &toStop : qAsConst(m_rootsPendingStop)) {
toStop->stop();
+ m_animationRoots.remove(toStop.data());
+ }
m_rootsPendingStop.clear();
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
index bbe0192eac..bdf9401997 100644
--- a/src/quickwidgets/qquickwidget.cpp
+++ b/src/quickwidgets/qquickwidget.cpp
@@ -1399,6 +1399,7 @@ bool QQuickWidget::event(QEvent *e)
switch (e->type()) {
+ case QEvent::Leave:
case QEvent::TouchBegin:
case QEvent::TouchEnd:
case QEvent::TouchUpdate:
@@ -1452,6 +1453,14 @@ bool QQuickWidget::event(QEvent *e)
case QEvent::ShortcutOverride:
return QCoreApplication::sendEvent(d->offscreenWindow, e);
+ case QEvent::Enter: {
+ QEnterEvent *enterEvent = static_cast<QEnterEvent *>(e);
+ QEnterEvent mappedEvent(enterEvent->localPos(), enterEvent->windowPos(),
+ enterEvent->screenPos());
+ const bool ret = QCoreApplication::sendEvent(d->offscreenWindow, &mappedEvent);
+ e->setAccepted(mappedEvent.isAccepted());
+ return ret;
+ }
default:
break;
}
diff --git a/tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp b/tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp
index d4922599be..363064aa31 100644
--- a/tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp
+++ b/tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp
@@ -192,7 +192,8 @@ void tst_QQuickFramebufferObject::testThatStuffWorks()
item->setMsaa(msaa);
view.show();
- QTest::qWaitForWindowExposed(&view);
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
QImage result = view.grabWindow();
@@ -231,7 +232,8 @@ void tst_QQuickFramebufferObject::testInvalidate()
item->setTextureSize(QSize(200, 200));
view.show();
- QTest::qWaitForWindowExposed(&view);
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
QCOMPARE(frameInfo.fboSize, QSize(200, 200));
diff --git a/tests/auto/quick/qquicklistview/data/qtbug63974.qml b/tests/auto/quick/qquicklistview/data/qtbug63974.qml
new file mode 100644
index 0000000000..1e0afa54f8
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/qtbug63974.qml
@@ -0,0 +1,34 @@
+import QtQuick 2.6
+
+ListView {
+ id: table
+ height: 200
+ width: 100
+
+ headerPositioning: ListView.OverlayHeader
+ header: Rectangle {
+ width: table.width
+ height: 20
+ color: "red"
+ z: 100
+ }
+
+ footerPositioning: ListView.OverlayFooter
+ footer: Rectangle {
+ width: table.width
+ height: 20
+ color: "blue"
+ z: 200
+ }
+
+ model: 30
+ delegate: Rectangle {
+ height: 20
+ width: table.width
+ color: "lightgray"
+ Text {
+ text: "Item " + index
+ anchors.centerIn: parent
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index a31cb37c16..f06a118976 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -256,6 +256,7 @@ private slots:
void keyNavigationEnabled();
void QTBUG_61269_appendDuringScrollDown();
void QTBUG_50097_stickyHeader_positionViewAtIndex();
+ void QTBUG_63974_stickyHeader_positionViewAtIndex_Contain();
void itemFiltered();
void releaseItems();
@@ -8561,6 +8562,46 @@ void tst_QQuickListView::QTBUG_50097_stickyHeader_positionViewAtIndex()
QTRY_COMPARE(listview->contentY(), -100.0); // back to the same position: header visible, items not under the header.
}
+void tst_QQuickListView::QTBUG_63974_stickyHeader_positionViewAtIndex_Contain()
+{
+ QScopedPointer<QQuickView> window(createView());
+ window->setSource(testFileUrl("qtbug63974.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject());
+ QVERIFY(listview != 0);
+
+ const qreal headerSize = 20;
+ const qreal footerSize = 20;
+ const qreal itemSize = 20;
+ const int itemCount = 30;
+ const qreal contentHeight = itemCount * itemSize;
+
+ const qreal initialY = listview->contentY();
+ const qreal endPosition = contentHeight + footerSize - listview->height();
+
+ QVERIFY(qFuzzyCompare(initialY, -headerSize));
+
+ listview->positionViewAtIndex(itemCount - 1, QQuickListView::Contain);
+ QTRY_COMPARE(listview->contentY(), endPosition);
+
+ listview->positionViewAtIndex(0, QQuickListView::Contain);
+ QTRY_COMPARE(listview->contentY(), -headerSize);
+
+ listview->positionViewAtIndex(itemCount - 1, QQuickListView::Visible);
+ QTRY_COMPARE(listview->contentY(), endPosition);
+
+ listview->positionViewAtIndex(0, QQuickListView::Visible);
+ QTRY_COMPARE(listview->contentY(), -headerSize);
+
+ listview->positionViewAtIndex(itemCount - 1, QQuickListView::SnapPosition);
+ QTRY_COMPARE(listview->contentY(), endPosition);
+
+ listview->positionViewAtIndex(0, QQuickListView::SnapPosition);
+ QTRY_COMPARE(listview->contentY(), -headerSize);
+}
+
void tst_QQuickListView::itemFiltered()
{
QStringListModel model(QStringList() << "one" << "two" << "three" << "four" << "five" << "six");
@@ -8617,9 +8658,9 @@ void tst_QQuickListView::QTBUG_34576_velocityZero()
QVERIFY(QTest::qWaitForWindowExposed(window));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
- QTRY_VERIFY(listview != 0);
+ QVERIFY(listview);
QQuickItem *contentItem = listview->contentItem();
- QTRY_VERIFY(contentItem != 0);
+ QVERIFY(contentItem);
QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
QSignalSpy horizontalVelocitySpy(listview, SIGNAL(horizontalVelocityChanged()));
@@ -8631,20 +8672,21 @@ void tst_QQuickListView::QTBUG_34576_velocityZero()
window->rootObject()->setProperty("horizontalVelocityZeroCount", QVariant(0));
listview->setCurrentIndex(2);
QTRY_COMPARE(window->rootObject()->property("current").toInt(), 2);
- QTRY_COMPARE(horizontalVelocitySpy.count(), 0);
- QTRY_COMPARE(window->rootObject()->property("horizontalVelocityZeroCount").toInt(), 0);
+ QCOMPARE(horizontalVelocitySpy.count(), 0);
+ QCOMPARE(window->rootObject()->property("horizontalVelocityZeroCount").toInt(), 0);
+
+ QSignalSpy currentIndexChangedSpy(listview, SIGNAL(currentIndexChanged()));
// click button which increases currentIndex
QTest::mousePress(window, Qt::LeftButton, 0, QPoint(295,215));
QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(295,215));
// verify that currentIndexChanged is triggered
- QVERIFY(horizontalVelocitySpy.wait());
+ QTRY_VERIFY(currentIndexChangedSpy.count() > 0);
- // set currentIndex to item out of view to cause listview scroll
+ // since we have set currentIndex to an item out of view, the listview will scroll
QTRY_COMPARE(window->rootObject()->property("current").toInt(), 3);
- QTRY_COMPARE(horizontalVelocitySpy.count() > 0, true);
- QVERIFY(horizontalVelocitySpy.wait(1000));
+ QTRY_VERIFY(horizontalVelocitySpy.count() > 0);
// velocity should be always > 0.0
QTRY_COMPARE(window->rootObject()->property("horizontalVelocityZeroCount").toInt(), 0);
diff --git a/tests/auto/quick/qquickshadereffect/tst_qquickshadereffect.cpp b/tests/auto/quick/qquickshadereffect/tst_qquickshadereffect.cpp
index fe33dbd4d8..1731253da6 100644
--- a/tests/auto/quick/qquickshadereffect/tst_qquickshadereffect.cpp
+++ b/tests/auto/quick/qquickshadereffect/tst_qquickshadereffect.cpp
@@ -52,8 +52,8 @@ public:
int signalsConnected = 0;
protected:
- void connectNotify(const QMetaMethod &) { ++signalsConnected; }
- void disconnectNotify(const QMetaMethod &) { --signalsConnected; }
+ void connectNotify(const QMetaMethod &) override { ++signalsConnected; }
+ void disconnectNotify(const QMetaMethod &) override { --signalsConnected; }
signals:
void dummyChanged();
@@ -257,7 +257,7 @@ void tst_qquickshadereffect::lookThroughShaderCode()
QQmlComponent component(&engine);
component.setData("import QtQuick 2.0\nimport ShaderEffectTest 1.0\nTestShaderEffect {}", QUrl());
QScopedPointer<TestShaderEffect> item(qobject_cast<TestShaderEffect*>(component.create()));
- QCOMPARE(item->signalsConnected, 1);
+ QCOMPARE(item->signalsConnected, 0);
QString expected;
if ((presenceFlags & VertexPresent) == 0)
@@ -274,7 +274,7 @@ void tst_qquickshadereffect::lookThroughShaderCode()
QCOMPARE(item->parseLog(), expected);
// If the uniform was successfully parsed, the notify signal has been connected to an update slot.
- QCOMPARE(item->signalsConnected, (presenceFlags & SourcePresent) ? 2 : 1);
+ QCOMPARE(item->signalsConnected, (presenceFlags & SourcePresent) ? 1 : 0);
}
void tst_qquickshadereffect::deleteSourceItem()
diff --git a/tests/auto/quick/quick.pro b/tests/auto/quick/quick.pro
index 9b7740646a..0f904e0c09 100644
--- a/tests/auto/quick/quick.pro
+++ b/tests/auto/quick/quick.pro
@@ -46,7 +46,7 @@ PRIVATETESTS += \
# This test requires the xmlpatterns module
!qtHaveModule(xmlpatterns): PRIVATETESTS -= qquickxmllistmodel
-QUICKTESTS = \
+QUICKTESTS += \
pointerhandlers \
qquickaccessible \
qquickanchors \
diff --git a/tests/auto/quickwidgets/qquickwidget/BLACKLIST b/tests/auto/quickwidgets/qquickwidget/BLACKLIST
new file mode 100644
index 0000000000..6594a22472
--- /dev/null
+++ b/tests/auto/quickwidgets/qquickwidget/BLACKLIST
@@ -0,0 +1,2 @@
+[enterLeave]
+osx
diff --git a/tests/auto/quickwidgets/qquickwidget/data/enterleave.qml b/tests/auto/quickwidgets/qquickwidget/data/enterleave.qml
new file mode 100644
index 0000000000..b3057e30ad
--- /dev/null
+++ b/tests/auto/quickwidgets/qquickwidget/data/enterleave.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Rectangle {
+ property bool hasMouse: mouseArea.containsMouse
+ height: 200
+ width: 200
+ MouseArea {
+ id: mouseArea
+ hoverEnabled: true
+ anchors.fill: parent
+ }
+}
diff --git a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
index 537fe99012..0bf2f8d7d8 100644
--- a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
+++ b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
@@ -65,6 +65,7 @@ private slots:
void nullEngine();
void keyEvents();
void shortcuts();
+ void enterLeave();
};
@@ -445,6 +446,30 @@ void tst_qquickwidget::shortcuts()
QTRY_VERIFY(filter.shortcutOk);
}
+void tst_qquickwidget::enterLeave()
+{
+ QQuickWidget view;
+ view.setSource(testFileUrl("enterleave.qml"));
+
+ // Ensure it is not inside the window first
+ QCursor::setPos(QPoint(50, 50));
+ QTRY_VERIFY(QCursor::pos() == QPoint(50, 50));
+
+ view.move(100, 100);
+ view.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&view, 5000));
+ QQuickItem *rootItem = view.rootObject();
+ QVERIFY(rootItem);
+
+ QTRY_VERIFY(!rootItem->property("hasMouse").toBool());
+ // Check the enter
+ QCursor::setPos(view.pos() + QPoint(50, 50));
+ QTRY_VERIFY(rootItem->property("hasMouse").toBool());
+ // Now check the leave
+ QCursor::setPos(view.pos() - QPoint(50, 50));
+ QTRY_VERIFY(!rootItem->property("hasMouse").toBool());
+}
+
QTEST_MAIN(tst_qquickwidget)
#include "tst_qquickwidget.moc"