diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-03-31 03:03:41 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@qt.io> | 2020-04-02 08:20:37 +0200 |
commit | b06a07cf9fd474e11fbe467047e5fe0322b677f0 (patch) | |
tree | ba8b1dd84c3d263b27a1865fff84a659b5273091 /tests/manual/mappolyline_tester/main.qml | |
parent | 4cfed13377ababcfaa7dacb055bcd3dd0f2cf7d4 (diff) | |
parent | 29816a3aaa3f368422a3b19983add62673bb6960 (diff) | |
download | qtlocation-b06a07cf9fd474e11fbe467047e5fe0322b677f0.tar.gz |
Merge 5.15 to dev and fix resulting compile issues
Conflicts:
src/imports/location/location.cpp
The change fixes the bare minimum of what needs to be done
to compile and run. This includes the following issues:
1. Fix build failures as a result of QMetaType changes in qtbase
moc now stores the QMetaType of properties as a result of
46f407126ef3e94d59254012cdc34d6a4ad2faf2 in qtbase, which requires
full type information about the property type inside the moc generated
source file.
Many of the property types were forward-declared, and this resulted
in build errors like:
"invalid application of 'sizeof' to an incomplete type 'QDeclarativeGeoMap'"
2. Adopts QtQML API changes. A private QJSValue ctor was removed.
The "replacement" is QJSValuePrivate::fromReturnedValue(..).
3. The mapboxgl 3rdparty backend does not compile at this point in time
and seems unmaintained. For the time being, the mapboxgl backend is disabled
in the interest of keeping qtlocation closer to dev HEAD of other
Qt modules.
Change-Id: I756e1c2effb29eaaf96a61a28c1c17338774b77c
Diffstat (limited to 'tests/manual/mappolyline_tester/main.qml')
-rw-r--r-- | tests/manual/mappolyline_tester/main.qml | 327 |
1 files changed, 327 insertions, 0 deletions
diff --git a/tests/manual/mappolyline_tester/main.qml b/tests/manual/mappolyline_tester/main.qml new file mode 100644 index 00000000..82e67a21 --- /dev/null +++ b/tests/manual/mappolyline_tester/main.qml @@ -0,0 +1,327 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.7 +import QtQuick.Window 2.2 +import QtQuick.Controls 2.13 as C2 +import QtPositioning 5.6 +import QtLocation 5.15 + +Window { + id: win + visible: true + width: 1600 + height: 800 + title: qsTr("MapPolyline tester") + + property real initialZL: 4 + property var initialCenter: QtPositioning.coordinate(55, -160) + property real rotation : 0 + + Shortcut { + sequence: "Ctrl+R" + onActivated: { + rotation = rotation + 36 + } + } + + function syncMaps(mFrom, mTo, propName) + { + if (mTo[propName] !== mFrom[propName]) { + mTo[propName] = mFrom[propName] + } + } + + Plugin { + id: osm // use only one plugin, to avoid messing up the cache + name: "osm" + } + Rectangle { + id: mapContainer + rotation: win.rotation + anchors.fill: parent + color: "lightsteelblue" + + Map { + id: map + rotation: win.rotation + gesture.enabled: true + objectName: "map1" + anchors { + bottom: parent.bottom + top: parent.top + left: parent.left + right: (leftSwitch.checked) ? parent.right : parent.horizontalCenter + } + + onCenterChanged: syncMaps(map, map2, "center") + onTiltChanged: syncMaps(map, map2, "tilt") + onBearingChanged: syncMaps(map, map2, "bearing") + onZoomLevelChanged: syncMaps(map, map2, "zoomLevel") + onFieldOfViewChanged: syncMaps(map, map2, "fieldOfView") + + opacity: 1.0 + color: 'transparent' + plugin: osm + center: initialCenter + activeMapType: map.supportedMapTypes[2] + zoomLevel: initialZL + z : parent.z + 1 + copyrightsVisible: false + + Component.onCompleted: { + var o = migComponent.createObject(map) + o.glPolylines = Qt.binding(function() {return switchPolylines1.currentText}) + map.addMapItemGroup(o); + } + MouseArea { + anchors.fill: parent + onClicked: { + mouse.accepted = false + var crd = map.toCoordinate(Qt.point(mouse.x, mouse.y)) + var s = crd.toString(0) + console.log("Clicked the map (not an Item) on ",s) + } + } + + C2.ComboBox { + model: ['Software','OpenGL LineStrip','OpenGL Triangles'] + id: switchPolylines1 + anchors { + top: parent.top + right: parent.right + topMargin: 12 + rightMargin: 12 + } + } + } + Map { + id: map2 + rotation: win.rotation + gesture.enabled: true + objectName: "map2" + visible: !leftSwitch.checked + anchors { + bottom: parent.bottom + top: parent.top + left: parent.horizontalCenter + right: parent.right + } + + onCenterChanged: syncMaps(map2, map, "center") + onTiltChanged: syncMaps(map2, map, "tilt") + onBearingChanged: syncMaps(map2, map, "bearing") + onZoomLevelChanged: syncMaps(map2, map, "zoomLevel") + onFieldOfViewChanged: syncMaps(map2, map, "fieldOfView") + + color: 'transparent' + plugin: osm + activeMapType: map.supportedMapTypes[2] + center: initialCenter + zoomLevel: initialZL + copyrightsVisible: false + + Component.onCompleted: { + var o = migComponent.createObject(map2) + o.glPolylines = Qt.binding(function() {return switchPolylines2.currentText}) + map2.addMapItemGroup(o); + } + + C2.ComboBox { + model: ['Software','OpenGL LineStrip','OpenGL Triangles'] + id: switchPolylines2 + anchors { + top: parent.top + right: parent.right + topMargin: 12 + rightMargin: 12 + } + onCurrentTextChanged: console.log("CURRENT TEXT CHANGED ",currentText) + } + } + } + + Component { + id: migComponent + MapItemGroup { + id: polyGroup + property bool glPolygons : true + property string glPolylines : "Software" + property bool glCircles : true + property bool glRectangles : true + objectName: parent.objectName + "_MIG_" + + function polylineBackend() + { + return (polyGroup.glPolylines === "OpenGL LineStrip") + ? MapPolyline.OpenGLLineStrip + : ((polyGroup.glPolylines === "Software") + ? MapPolyline.Software : MapPolyline.OpenGLExtruded) + } + + function polygonBackend() + { + return (polyGroup.glPolylines === "Software") + ? MapPolygon.Software : MapPolygon.OpenGL + } + + function miterValue() + { + return (miterSwitch.checked) ? Qt.RoundCap : Qt.FlatCap + } + + MapPolyline { + id: tstPolyLine // to verify the polygon stays where it's supposed to + line.color: 'black' + objectName: parent.objectName + "black" + line.width: 1 + opacity: 1.0 + backend: polylineBackend() + path: [ + { latitude: 76.9965, longitude: -175.012 }, + { latitude: 26.9965, longitude: -175.012 } + ] + } + + MapPolyline { + id: timeline + line.color: "red" + objectName: parent.objectName + "timeline" + line.width: 4 + backend: polylineBackend() + path: [ + { latitude: 90, longitude: 180 }, + { latitude: -90, longitude: -180 } + ] + } + + MapPolyline { + id: poly1 + line.color: "pink" + line.width: sliWidth.value + objectName: parent.objectName + "red" + backend: polylineBackend() + + path: [ + { latitude: 55, longitude: 170 }, + { latitude: 66.9965, longitude: 170 }, + { latitude: 66.9965, longitude: -175.012 }, + { latitude: 55, longitude: -160 }, + { latitude: 40, longitude: -165 }, + { latitude: 45, longitude: 174 }, + { latitude: 43, longitude: -168 } + ] + DynamicParameter { + type: "lineStyle" + property var lineCap: miterValue() + } + + MouseArea { + anchors.fill: parent + onClicked: console.log("poly1 in "+parent.parent.objectName + "clicked") + + Rectangle { // this is technically unsupported, but practically works. + color: "transparent" + border.color: "red" + anchors.fill: parent + } + } + } + + MapPolygon { + id: poly2 + color: "green" + border.color: "black" + border.width: 12 + objectName: parent.objectName + "green" + backend: polygonBackend() + path: [ + { latitude: -45, longitude: -170 }, + { latitude: -55, longitude: -155 }, + { latitude: -45, longitude: -130 }, + { latitude: -35, longitude: -155 } + ] + MouseArea{ + anchors.fill: parent + drag.target: parent + Rectangle { // this is technically unsupported, but practically works. + color: "transparent" + border.color: "red" + anchors.fill: parent + } + } + } + +// LongPolyline { +// id: longPolyline +// line.width: 10 +// line.color: 'firebrick' +// backend: polylineBackend() +// } + } + } + + + C2.Switch { + text: qsTr("Left") + id: leftSwitch + anchors { + top: parent.top + left: parent.left + leftMargin: 12 + rightMargin: 12 + } + checked: false + } + C2.Switch { + text: qsTr("Miter") + id: miterSwitch + anchors { + top: leftSwitch.bottom + left: parent.left + leftMargin: 12 + rightMargin: 12 + } + checked: false + } + C2.Slider { + id: sliWidth + orientation: Qt.Vertical + anchors { + left: parent.left + top: miterSwitch.bottom + bottom: parent.bottom + topMargin: 10 + leftMargin: 10 + bottomMargin: 10 + } + from: 1 + to: 50 + value: 50 + } +} |