diff options
author | Michal Klocek <michal.klocek@theqtcompany.com> | 2015-02-10 18:17:11 +0100 |
---|---|---|
committer | Michal Klocek <michal.klocek@theqtcompany.com> | 2015-04-13 14:53:55 +0000 |
commit | fb1395c2af753d559763f79b4d75320498f30ab5 (patch) | |
tree | d0c8c41ec01ccab56c5148bd690f30d86319fc0e /examples | |
parent | 6d50e7cd5ed38b9ea00e0fea8c525b64e6eba0e0 (diff) | |
download | qtlocation-fb1395c2af753d559763f79b4d75320498f30ab5.tar.gz |
Replace reverse geocode dialog in mapviewer example.
Reverse geocode dialog use qtquickcontrols now.
Change-Id: Ifb231fbdaf70e972516980407218386329b083b3
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/location/mapviewer/ReverseGeocode.qml | 73 | ||||
-rw-r--r-- | examples/location/mapviewer/mapviewer.qml | 39 | ||||
-rw-r--r-- | examples/location/mapviewer/mapviewerwrapper.qrc | 1 |
3 files changed, 79 insertions, 34 deletions
diff --git a/examples/location/mapviewer/ReverseGeocode.qml b/examples/location/mapviewer/ReverseGeocode.qml new file mode 100644 index 00000000..14ac5b0c --- /dev/null +++ b/examples/location/mapviewer/ReverseGeocode.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.4 +import QtPositioning 5.2 +import "forms" + +//Reverse Geocode Dialog +ReverseGeocodeForm { + + property variant coordinate + signal showPlace(variant coordinate) + signal closeForm() + + goButton.onClicked: { + var coordinate = QtPositioning.coordinate(parseFloat(latitude.text), + parseFloat(longitude.text)); + if (coordinate.isValid) { + showPlace(coordinate) + } + } + + clearButton.onClicked: { + latitude.text = "" + longitude.text = "" + } + + cancelButton.onClicked: { + closeForm() + } + + Component.onCompleted: { + latitude.text = "" + coordinate.latitude + longitude.text = "" + coordinate.longitude + } +} diff --git a/examples/location/mapviewer/mapviewer.qml b/examples/location/mapviewer/mapviewer.qml index 621f0726..e0751bbe 100644 --- a/examples/location/mapviewer/mapviewer.qml +++ b/examples/location/mapviewer/mapviewer.qml @@ -129,9 +129,11 @@ ApplicationWindow { properties: { "address": fromAddress}}) stackView.currentItem.showPlace.connect(showPlace) stackView.currentItem.closeForm.connect(closeForm) - } else { - stackView.pop(page) - page.state = tool + } else if (tool === "RevGeocode") { + stackView.push({ item: Qt.resolvedUrl("ReverseGeocode.qml") , + properties: { "coordinate": fromCoordinate}}) + stackView.currentItem.showPlace.connect(showPlace) + stackView.currentItem.closeForm.connect(closeForm) } } @@ -354,29 +356,6 @@ ApplicationWindow { //=====================Dialogs===================== - //Reverse Geocode Dialog - OwnControls.InputDialog { - id: reverseGeocodeDialog - title: "Reverse Geocode" - z: backgroundRect.z + 2 - - Component.onCompleted: { - var obj = [["Latitude","-27.575"],["Longitude", "153.088"]] - setModel(obj) - } - - onGoButtonClicked: { - page.state = "" - map.geocodeModel.query = QtPositioning.coordinate(parseFloat(dialogModel.get(0).inputText), - parseFloat(dialogModel.get(1).inputText)); - map.geocodeModel.update(); - } - - onCancelButtonClicked: { - page.state = "" - } - } - //Get new coordinates for marker OwnControls.InputDialog { id: coordinatesDialog @@ -431,10 +410,6 @@ ApplicationWindow { //=====================States of page===================== states: [ State { - name: "RevGeocode" - PropertyChanges { target: reverseGeocodeDialog; opacity: 1 } - }, - State { name: "Coordinates" PropertyChanges { target: coordinatesDialog; opacity: 1 } }, @@ -447,10 +422,6 @@ ApplicationWindow { //=====================State-transition animations for page===================== transitions: [ Transition { - to: "RevGeocode" - NumberAnimation { properties: "opacity" ; duration: 500; easing.type: Easing.Linear } - }, - Transition { to: "Coordinates" NumberAnimation { properties: "opacity" ; duration: 500; easing.type: Easing.Linear } }, diff --git a/examples/location/mapviewer/mapviewerwrapper.qrc b/examples/location/mapviewer/mapviewerwrapper.qrc index 2bf905ad..b5177a93 100644 --- a/examples/location/mapviewer/mapviewerwrapper.qrc +++ b/examples/location/mapviewer/mapviewerwrapper.qrc @@ -21,5 +21,6 @@ <file>RouteCoordinate.qml</file> <file>RouteAddress.qml</file> <file>Geocode.qml</file> + <file>ReverseGeocode.qml</file> </qresource> </RCC> |