diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/location/mapviewer/main.cpp | 1 | ||||
-rw-r--r-- | examples/location/mapviewer/map/MapComponent.qml | 1 | ||||
-rw-r--r-- | examples/location/mapviewer/map/MapSliders.qml | 42 | ||||
-rw-r--r-- | examples/location/mapviewer/mapviewer.qml | 12 |
4 files changed, 33 insertions, 23 deletions
diff --git a/examples/location/mapviewer/main.cpp b/examples/location/mapviewer/main.cpp index 3eedd8dd..c44e3d9e 100644 --- a/examples/location/mapviewer/main.cpp +++ b/examples/location/mapviewer/main.cpp @@ -88,6 +88,7 @@ int main(int argc, char *argv[]) for (const QByteArray &p : additionalLibraryPaths.split(':')) QCoreApplication::addLibraryPath(QString(p)); + QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication application(argc, argv); QVariantMap parameters; diff --git a/examples/location/mapviewer/map/MapComponent.qml b/examples/location/mapviewer/map/MapComponent.qml index c3d5dfd2..c450a150 100644 --- a/examples/location/mapviewer/map/MapComponent.qml +++ b/examples/location/mapviewer/map/MapComponent.qml @@ -61,6 +61,7 @@ Map { property alias routeQuery: routeQuery property alias routeModel: routeModel property alias geocodeModel: geocodeModel + property alias slidersExpanded: sliders.expanded signal showGeocodeInfo() signal geocodeFinished() diff --git a/examples/location/mapviewer/map/MapSliders.qml b/examples/location/mapviewer/map/MapSliders.qml index 75e4f474..8e24481f 100644 --- a/examples/location/mapviewer/map/MapSliders.qml +++ b/examples/location/mapviewer/map/MapSliders.qml @@ -41,6 +41,7 @@ import QtQuick 2.6 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 +import QtQuick.Controls 2.0 as C2 Row { id: containerRow @@ -49,6 +50,7 @@ Row { property real fontSize : 14 property color labelBackground : "transparent" property int edge: Qt.RightEdge + property alias expanded: sliderToggler.checked function rightEdge() { return (containerRow.edge === Qt.RightEdge); @@ -65,7 +67,7 @@ Row { width: 32 height: 96 checkable: true - checked: false + checked: true anchors.verticalCenter: parent.verticalCenter transform: Scale { @@ -204,59 +206,53 @@ Row { // The sliders row Row { - spacing: 10 + spacing: -10 id: sliderRow height: sliderContainer.slidersHeight - Slider { + C2.Slider { id: zoomSlider height: parent.height orientation : Qt.Vertical + from : containerRow.mapSource.minimumZoomLevel + to : containerRow.mapSource.maximumZoomLevel + value : containerRow.mapSource.zoomLevel onValueChanged: { containerRow.mapSource.zoomLevel = value } - Component.onCompleted: { - minimumValue = Qt.binding(function() { return containerRow.mapSource.minimumZoomLevel; }) - maximumValue = Qt.binding(function() { return containerRow.mapSource.maximumZoomLevel; }) - value = Qt.binding(function() { return containerRow.mapSource.zoomLevel; }) - } } - Slider { + C2.Slider { id: bearingSlider height: parent.height - minimumValue: 0 - maximumValue: 360 + from: 0 + to: 360 orientation : Qt.Vertical value: containerRow.mapSource.bearing onValueChanged: { containerRow.mapSource.bearing = value; } } - Slider { + C2.Slider { id: tiltSlider height: parent.height orientation : Qt.Vertical + from: containerRow.mapSource.minimumTilt; + to: containerRow.mapSource.maximumTilt + value: containerRow.mapSource.tilt onValueChanged: { containerRow.mapSource.tilt = value; } - Component.onCompleted: { - minimumValue = Qt.binding(function() { return containerRow.mapSource.minimumTilt; }) - maximumValue = Qt.binding(function() { return containerRow.mapSource.maximumTilt; }) - value = Qt.binding(function() { return containerRow.mapSource.tilt; }) - } } - Slider { + C2.Slider { id: fovSlider height: parent.height orientation : Qt.Vertical + from: containerRow.mapSource.minimumFieldOfView + to: containerRow.mapSource.maximumFieldOfView + value: containerRow.mapSource.fieldOfView onValueChanged: { containerRow.mapSource.fieldOfView = value; } - Component.onCompleted: { - minimumValue = Qt.binding(function() { return containerRow.mapSource.minimumFieldOfView; }) - maximumValue = Qt.binding(function() { return containerRow.mapSource.maximumFieldOfView; }) - value = Qt.binding(function() { return containerRow.mapSource.fieldOfView; }) - } } } // Row sliders diff --git a/examples/location/mapviewer/mapviewer.qml b/examples/location/mapviewer/mapviewer.qml index 21348919..debc329f 100644 --- a/examples/location/mapviewer/mapviewer.qml +++ b/examples/location/mapviewer/mapviewer.qml @@ -73,10 +73,18 @@ ApplicationWindow { } var zoomLevel = null + var tilt = null + var bearing = null + var fov = null var center = null + var panelExpanded = null if (map) { zoomLevel = map.zoomLevel + tilt = map.tilt + bearing = map.bearing + fov = map.fieldOfView center = map.center + panelExpanded = map.slidersExpanded map.destroy() } @@ -84,8 +92,12 @@ ApplicationWindow { map.plugin = plugin; if (zoomLevel != null) { + map.tilt = tilt + map.bearing = bearing + map.fieldOfView = fov map.zoomLevel = zoomLevel map.center = center + map.slidersExpanded = panelExpanded } else { // Use an integer ZL to enable nearest interpolation, if possible. map.zoomLevel = Math.floor((map.maximumZoomLevel - map.minimumZoomLevel)/2) |