From fd6c6e9654a14788fc4eb7384c9dfa5de1f5ffde Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Mon, 7 May 2018 16:46:12 +0200 Subject: Enable nested MapItemViews This change allows MapItemView to use a MapItem, MapItemGroup or MapItemView as delegate. To achieve this, MapItemView base class also changes from QObject to MapItemGroup, effectively making MapItemView a MapItemGroup. Note, though, that MapItemGroup API in Map should be avoided, when dealing with a MapItemView, and only MapItemView-specific API should be used. Tests and example coming after [ChangeLog][QtLocation] Enabled nesting of MapItemView. This required a behavioral change, as MapItemView is now a MapItemGroup, not anymore a plain QObject. Due to a bug, MapItemView was previously not a Qt Quick Item, making it possible to create it as a child of any QObject. This has now been fixed, so if you happen to have a MapItemView in your scene which is not a child of a Qt Quick Item, you will get an error message. Task-number: QTBUG-62683 Task-number: QTBUG-62397 Change-Id: Id97e480429e7f952a541fe88df5c01317afeac18 Reviewed-by: Alex Blasche --- tests/auto/declarative_ui/tst_map_itemview.qml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/declarative_ui/tst_map_itemview.qml b/tests/auto/declarative_ui/tst_map_itemview.qml index 097212ca..0ab9d494 100644 --- a/tests/auto/declarative_ui/tst_map_itemview.qml +++ b/tests/auto/declarative_ui/tst_map_itemview.qml @@ -28,7 +28,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtLocation 5.6 +import QtLocation 5.12 import QtPositioning 5.5 import QtLocation.Test 5.5 @@ -49,6 +49,7 @@ Item { MapItemView { id: routeItemViewExtra model: routeModel + incubateDelegates: false delegate: Component { MapRoute { route: routeData @@ -58,6 +59,10 @@ Item { MapItemView { id: listModelItemViewExtra + objectName: "listModelItemViewExtra" + incubateDelegates: false + add: null + remove: null model: ListModel { id: testingListModelExtra ListElement { lat: 11; lon: 31 } @@ -252,6 +257,9 @@ Item { MapItemView { id: listModelItemView + incubateDelegates: false + add: null + remove: null model: ListModel { id: testingListModel ListElement { lat: 11; lon: 31 } @@ -487,7 +495,7 @@ Item { testingListModelExtra.clear() tryCompare(mapForTestingListModel, "mapItemsLength", 0) mapForTestingListModel.removeMapItemView(listModelItemViewExtra) - + tryCompare(mapForTestingListModel, "mapItemsLength", 0) mapForTestingListModel.addMapItemView(listModelItemView) tryCompare(mapForTestingListModel, "mapItemsLength", 3) -- cgit v1.2.1