diff options
author | Liang Qi <liang.qi@qt.io> | 2017-03-15 15:47:35 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-03-15 15:47:45 +0100 |
commit | a30343fe6aa4c15fcee4a14eabe45473a88056db (patch) | |
tree | 5a9da17986ad7449b236ec94b1c0586256dca4f0 /examples | |
parent | 1e9250c34bf841fe01a5b3c609d9093cb791840d (diff) | |
parent | 324b1a939bc98e97b05f7a186e91a5ad694bb09b (diff) | |
download | qtlocation-a30343fe6aa4c15fcee4a14eabe45473a88056db.tar.gz |
Merge remote-tracking branch 'origin/5.9' into dev
Change-Id: I1832dd2484c92653089ba6419dfa3cc877a3a0c2
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 | 17 | ||||
-rw-r--r-- | examples/positioning/positioning.pro | 5 | ||||
-rw-r--r-- | examples/positioning/weatherinfo/weatherinfo.pro | 1 |
6 files changed, 42 insertions, 25 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 08ef2663..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,10 +92,17 @@ 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 { - map.zoomLevel = (map.maximumZoomLevel - map.minimumZoomLevel)/2 + // Use an integer ZL to enable nearest interpolation, if possible. + map.zoomLevel = Math.floor((map.maximumZoomLevel - map.minimumZoomLevel)/2) + // defaulting to 45 degrees, if possible. + map.fieldOfView = Math.min(Math.max(45.0, map.minimumFieldOfView), map.maximumFieldOfView) } map.forceActiveFocus() diff --git a/examples/positioning/positioning.pro b/examples/positioning/positioning.pro index 0e436b46..bbdc1a42 100644 --- a/examples/positioning/positioning.pro +++ b/examples/positioning/positioning.pro @@ -1,4 +1,7 @@ TEMPLATE = subdirs qtHaveModule(widgets): SUBDIRS += logfilepositionsource -qtHaveModule(quick): SUBDIRS += geoflickr weatherinfo satelliteinfo +qtHaveModule(quick) { + SUBDIRS += geoflickr satelliteinfo + qtHaveModule(network): SUBDIRS += weatherinfo +} diff --git a/examples/positioning/weatherinfo/weatherinfo.pro b/examples/positioning/weatherinfo/weatherinfo.pro index e2b2102d..d8f9675a 100644 --- a/examples/positioning/weatherinfo/weatherinfo.pro +++ b/examples/positioning/weatherinfo/weatherinfo.pro @@ -2,6 +2,7 @@ TEMPLATE = app TARGET = weatherinfo QT += core network positioning qml quick +requires(qtConfig(bearermanagement)) SOURCES += main.cpp \ appmodel.cpp |