diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2012-07-25 14:04:47 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-26 05:54:37 +0200 |
commit | 419296133aa68a317838e047b22513f1e5508b47 (patch) | |
tree | e3a0597f6d9c83cc2ac06eba385decd3ec12ff62 /tests/auto/quick/qquickmousearea | |
parent | 57485805057eda17008d14ca618e9c1f69a5a35d (diff) |
Fix resolution of cursor when items are overlapping.
If MouseArea with cursorShapes are overlapping then cursor shape
of the foremost item under the mouse cursor should be shown, but because
the hover events are delivered to the foremost items first the opposite
is occuring. This makes QQuickWindow responsible for correctly setting
its own cursor instead of relying on items to work it out amongst
themselves.
Change-Id: Iedf144c583dfa3d1ff441e19db9601b5e171902a
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'tests/auto/quick/qquickmousearea')
-rw-r--r-- | tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp index 67a36af6bb..f7ccd67f5f 100644 --- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp +++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp @@ -85,6 +85,9 @@ private slots: void pressedMultipleButtons_data(); void pressedMultipleButtons(); void changeAxis(); +#ifndef QT_NO_CURSOR + void cursorShape(); +#endif private: void acceptedButton_data(); @@ -1366,6 +1369,36 @@ void tst_QQuickMouseArea::changeAxis() delete view; } +#ifndef QT_NO_CURSOR +void tst_QQuickMouseArea::cursorShape() +{ + QQmlEngine engine; + QQmlComponent component(&engine); + component.setData("import QtQuick 2.0\n MouseArea {}", QUrl()); + QScopedPointer<QObject> object(component.create()); + QQuickMouseArea *mouseArea = qobject_cast<QQuickMouseArea *>(object.data()); + QVERIFY(mouseArea); + + QSignalSpy spy(mouseArea, SIGNAL(cursorShapeChanged())); + + QCOMPARE(mouseArea->cursorShape(), Qt::ArrowCursor); + QCOMPARE(mouseArea->cursor().shape(), Qt::ArrowCursor); + + mouseArea->setCursorShape(Qt::IBeamCursor); + QCOMPARE(mouseArea->cursorShape(), Qt::IBeamCursor); + QCOMPARE(mouseArea->cursor().shape(), Qt::IBeamCursor); + QCOMPARE(spy.count(), 1); + + mouseArea->setCursorShape(Qt::IBeamCursor); + QCOMPARE(spy.count(), 1); + + mouseArea->setCursorShape(Qt::WaitCursor); + QCOMPARE(mouseArea->cursorShape(), Qt::WaitCursor); + QCOMPARE(mouseArea->cursor().shape(), Qt::WaitCursor); + QCOMPARE(spy.count(), 2); +} +#endif + QTEST_MAIN(tst_QQuickMouseArea) #include "tst_qquickmousearea.moc" |