summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@nokia.com>2012-03-23 12:55:35 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-26 07:17:32 +0200
commit7c3f383152f5c35df70a33b7dd60463786399a67 (patch)
tree8a43e7cf0739b0f158e7c56831ea77de97605a35
parent946ce56da7ec2bc6bf054feaa8c2222d79749759 (diff)
downloadqtlocation-7c3f383152f5c35df70a33b7dd60463786399a67.tar.gz
Remove use of Loader element in Dialogs.
Simplify the code by removing the Loader element. There is really no need for it as a content item can be constructed directly. Factor out the code for text field entry dialogs into a separate InputDialog element. Dialogs that create a custom content item no longer carry around unneeded API. Account for the possibility of an on screen virtual keyboard. Change-Id: I808e040c264b8c8389a03070cc628e2e4518d118 Reviewed-by: Alex Wilson <alex.wilson@nokia.com> Reviewed-by: abcd <amos.choy@nokia.com>
-rw-r--r--examples/declarative/common/common.pri1
-rw-r--r--examples/declarative/common/common.qrc1
-rw-r--r--examples/declarative/common/imports/QtLocation/examples/dialogs/Dialog.qml155
-rw-r--r--examples/declarative/common/imports/QtLocation/examples/dialogs/ErrorDialog.qml2
-rw-r--r--examples/declarative/common/imports/QtLocation/examples/dialogs/InputDialog.qml94
-rw-r--r--examples/declarative/common/imports/QtLocation/examples/qmldir1
-rw-r--r--examples/declarative/mapviewer/content/dialogs/RouteDialog.qml696
-rw-r--r--examples/declarative/mapviewer/mapviewer.qml8
-rw-r--r--examples/declarative/places/content/places/CategoryDialog.qml2
-rw-r--r--examples/declarative/places/content/places/OptionsDialog.qml128
-rw-r--r--examples/declarative/places/content/places/PlaceDialog.qml7
-rw-r--r--examples/declarative/places/places.qml6
12 files changed, 523 insertions, 578 deletions
diff --git a/examples/declarative/common/common.pri b/examples/declarative/common/common.pri
index 619c2186..30ede711 100644
--- a/examples/declarative/common/common.pri
+++ b/examples/declarative/common/common.pri
@@ -29,6 +29,7 @@ OTHER_FILES += $$qmlcomponentsstyle.files
qmldialogs.files += \
$$PWD/imports/QtLocation/examples/dialogs/Dialog.qml \
+ $$PWD/imports/QtLocation/examples/dialogs/InputDialog.qml \
$$PWD/imports/QtLocation/examples/dialogs/ErrorDialog.qml
OTHER_FILES += $$qmldialogs.files
diff --git a/examples/declarative/common/common.qrc b/examples/declarative/common/common.qrc
index 344774a1..bfd79b73 100644
--- a/examples/declarative/common/common.qrc
+++ b/examples/declarative/common/common.qrc
@@ -15,6 +15,7 @@
<file>imports/QtLocation/examples/components/TextWithLabel.qml</file>
<file>imports/QtLocation/examples/components/TitleBar.qml</file>
<file>imports/QtLocation/examples/dialogs/Dialog.qml</file>
+ <file>imports/QtLocation/examples/dialogs/InputDialog.qml</file>
<file>imports/QtLocation/examples/dialogs/ErrorDialog.qml</file>
<file>resources/busy.png</file>
<file>resources/button_pressed.png</file>
diff --git a/examples/declarative/common/imports/QtLocation/examples/dialogs/Dialog.qml b/examples/declarative/common/imports/QtLocation/examples/dialogs/Dialog.qml
index 8abaf45f..a7592aba 100644
--- a/examples/declarative/common/imports/QtLocation/examples/dialogs/Dialog.qml
+++ b/examples/declarative/common/imports/QtLocation/examples/dialogs/Dialog.qml
@@ -43,134 +43,91 @@ import "../components"
Item {
id: dialog
+
signal goButtonClicked
signal cancelButtonClicked
signal clearButtonClicked
- anchors.fill: parent
-
property alias title: titleBar.text
- property alias dialogModel: dialogModel
- property alias length: dialogModel.count
+
property int gap: 10
- property int listItemHeight: titleBar.font.pixelSize * 1.5
- property alias customLoader: componentLoader
property bool showButtons: true
+ property Item item
opacity: 0
+ anchors.fill: parent
- function setModel(objects)
- {
- dialogModel.clear()
+ Fader {}
- for (var i=0; i< objects.length; i++){
- dialogModel.append({"labelText": objects[i][0], "inputText": objects[i][1]})
- }
+ onItemChanged: {
+ if (item)
+ item.parent = dataRect;
}
- Fader {}
-
Rectangle {
id: dialogRectangle
+ property int maximumDialogHeight: {
+ if (dialog.opacity === 0 ||
+ (Qt.inputMethod.keyboardRectangle.width === 0 && Qt.inputMethod.keyboardRectangle.height === 0)) {
+ return dialog.height;
+ } else {
+ return dialog.mapFromItem(null, Qt.inputMethod.keyboardRectangle.x, Qt.inputMethod.keyboardRectangle.y).y
+ }
+ }
+ property int maximumContentHeight: maximumDialogHeight - titleBar.height - buttons.height - gap*1.5
+
color: "#ECECEC"
opacity: parent.opacity
- width: parent.width - gap;
- height: dataRect.height + titleBar.height + buttons.height + gap*1.5
- anchors {
- verticalCenter: parent.verticalCenter
- left: parent.left
- leftMargin: gap/2
- }
+ height: dataRect.height + titleBar.height + buttons.height + gap*1.5
+ y: (maximumDialogHeight - height) / 2
+ anchors.left: parent.left
+ anchors.leftMargin: gap/2
+ anchors.right: parent.right
+ anchors.rightMargin: gap/2
radius: 5
TitleBar {
id: titleBar;
- width: parent.width; height: 40;
- anchors.top: parent.top; anchors.left: parent.left;
- opacity: 0.9
- onClicked: { dialog.cancelButtonClicked() }
- }
-
- ListModel {
- id: dialogModel
- }
-
- Component{
- id: listDelegate
- TextWithLabel {
- id: textWithLabel
- label: labelText
- text: inputText
- width: dataRect.width - gap
- labelWidth: 95
+ height: 40
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
- onTextChanged:
- {
- dialogModel.set(index, {"inputText": text})
- }
+ opacity: 0.9
+ onClicked: {
+ Qt.inputMethod.hide();
+ dialog.cancelButtonClicked();
}
- }
- Rectangle {
- id: dataRect
- color: "#ECECEC"
- radius: 5
- width:dialogRectangle.width - gap
- height: childrenRect.height + gap
- anchors {
- top: titleBar.bottom
- topMargin: gap/2
- left: parent.left
- leftMargin: gap/2
}
- Loader {
- id: componentLoader;
- anchors {
- top: dataRect.top
- topMargin: gap/2
- left: parent.left
- leftMargin: gap/2
- right: parent.right
- rightMargin: gap/2
+ Rectangle {
+ id: dataRect
+ color: "#ECECEC"
+ radius: 5
+
+ anchors.top: titleBar.bottom
+ anchors.left: dialogRectangle.left
+ anchors.right: dialogRectangle.right
+ anchors.margins: gap/2
+ height: Math.min(dialogRectangle.maximumContentHeight, item ? item.implicitHeight : 0)
+
+ Binding {
+ target: item
+ property: "anchors.fill"
+ value: dataRect
}
-
- Component.onCompleted: {
- if (!sourceComponent)
- sourceComponent = listComponent;
+ Binding {
+ target: item
+ property: "anchors.margins"
+ value: gap/2
}
-
}
- Component {
- id: listComponent
-
- ListView {
- id: listview
- model: dialogModel
- delegate: listDelegate
- spacing: gap/2
- clip: true
- snapMode: ListView.SnapToItem
- interactive: height < (listItemHeight + gap/2)*length + gap/2
- width: parent.width
- height: Math.min(dialog.height * 0.7, (listItemHeight + gap/2)*length + gap/2)
-
- Connections {
- target: dialog
- onClearButtonClicked: {
- for (var i = 0; i<length; i++)
- dialogModel.set(i, {"inputText": ""})
- }
- }
- }
- }
- }
-
Row {
id: buttons
anchors.top: dataRect.bottom
@@ -182,16 +139,16 @@ Item {
Button {
id: buttonClearAll
text: "Clear"
- width: 80; height: parent.height
+ width: 80
+ height: parent.height
onClicked: dialog.clearButtonClicked()
}
Button {
id: buttonGo
text: "Go!"
- width: 80; height: parent.height
- onClicked: {
- dialog.goButtonClicked ()
- }
+ width: 80
+ height: parent.height
+ onClicked: dialog.goButtonClicked()
}
}
}
diff --git a/examples/declarative/common/imports/QtLocation/examples/dialogs/ErrorDialog.qml b/examples/declarative/common/imports/QtLocation/examples/dialogs/ErrorDialog.qml
index be94c2cd..1b312da5 100644
--- a/examples/declarative/common/imports/QtLocation/examples/dialogs/ErrorDialog.qml
+++ b/examples/declarative/common/imports/QtLocation/examples/dialogs/ErrorDialog.qml
@@ -47,7 +47,7 @@ Dialog {
opacity: 0
showButtons:false
- customLoader.sourceComponent: Text {
+ item: Text {
id: errorText
text: errorRoot.text
}
diff --git a/examples/declarative/common/imports/QtLocation/examples/dialogs/InputDialog.qml b/examples/declarative/common/imports/QtLocation/examples/dialogs/InputDialog.qml
new file mode 100644
index 00000000..6d9822ab
--- /dev/null
+++ b/examples/declarative/common/imports/QtLocation/examples/dialogs/InputDialog.qml
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** 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 Nokia Corporation and its Subsidiary(-ies) 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.0
+import "../components"
+
+Dialog {
+ id: dialog
+
+ property alias dialogModel: dialogModel
+ property alias length: dialogModel.count
+
+ property int listItemHeight: 21
+
+ onClearButtonClicked: {
+ for (var i = 0; i < length; ++i)
+ dialogModel.set(i, { "inputText": "" });
+ }
+
+ item: ListView {
+ id: listview
+
+ model: dialogModel
+ delegate: listDelegate
+ spacing: gap/2
+ clip: true
+ snapMode: ListView.SnapToItem
+ implicitHeight: (listItemHeight + gap/2)*length + gap/2
+ interactive: height < implicitHeight
+ width: parent.width
+ }
+
+ function setModel(objects) {
+ dialogModel.clear();
+ for (var i = 0; i < objects.length; ++i) {
+ dialogModel.append({ "labelText": objects[i][0], "inputText": objects[i][1] });
+ }
+ }
+
+ ListModel {
+ id: dialogModel
+ }
+
+ Component {
+ id: listDelegate
+
+ TextWithLabel {
+ id: textWithLabel
+ label: labelText
+ text: inputText
+ width: parent ? parent.width : 0
+ labelWidth: 95
+
+ onTextChanged: dialogModel.set(index, {"inputText": text})
+ }
+ }
+}
diff --git a/examples/declarative/common/imports/QtLocation/examples/qmldir b/examples/declarative/common/imports/QtLocation/examples/qmldir
index 34469887..9089f6c0 100644
--- a/examples/declarative/common/imports/QtLocation/examples/qmldir
+++ b/examples/declarative/common/imports/QtLocation/examples/qmldir
@@ -10,3 +10,4 @@ TextWithLabel 5.0 components/TextWithLabel.qml
TitleBar 5.0 components/TitleBar.qml
Dialog 5.0 dialogs/Dialog.qml
ErrorDialog 5.0 dialogs/ErrorDialog.qml
+InputDialog 5.0 dialogs/InputDialog.qml
diff --git a/examples/declarative/mapviewer/content/dialogs/RouteDialog.qml b/examples/declarative/mapviewer/content/dialogs/RouteDialog.qml
index 588f511a..f1ed8f05 100644
--- a/examples/declarative/mapviewer/content/dialogs/RouteDialog.qml
+++ b/examples/declarative/mapviewer/content/dialogs/RouteDialog.qml
@@ -42,16 +42,12 @@ import QtQuick 2.0
import QtLocation 5.0
import QtLocation.examples 5.0
-Item {
+Dialog {
id: dialog
- signal goButtonClicked
- signal cancelButtonClicked
- anchors.fill: parent
- property int gap: 6
- opacity: 0
+ title: "Route"
+ gap: 6
- property alias title: titleBar.text
property alias startLatitude: latFrom.text
property alias startLongitude: longFrom.text
property alias endLatitude: latTo.text
@@ -63,6 +59,7 @@ Item {
property alias endCity: cityTo.text
property alias endCountry: countryTo.text
property alias byCoordinates: coord.enabled
+
property int travelMode: RouteQuery.CarTravel // CarTravel, PedestrianTravel, BicycleTravel, PublicTransitTravel, TruckTravel
property int routeOptimization: RouteQuery.FastestRoute // ShortestRoute, FastestRoute, MostEconomicRoute, MostScenicRoute
property variant features: [] // NoFeature, TollFeature, HighwayFeature, PublicTransitFeature, FerryFeature, TunnelFeature, DirtRoadFeature, ParksFeature, MotorPoolLaneFeature
@@ -72,427 +69,386 @@ Item {
property color backgroundColorEnabled: "#98D0FC"
property color backgroundColorDisabled: "grey"
- Fader {}
-
- Rectangle {
- id: dialogRectangle
- color: backgroundColorNormal
- opacity: 1
- width: parent.width - gap*2;
- height: options.height + gap*4 + buttons.height + titleBar.height + routeOptions.height
-
- anchors {
- verticalCenter: parent.verticalCenter
- left: parent.left
- leftMargin: gap
- }
-
- radius: 5
-
- TitleBar {
- id: titleBar;
- width: parent.width; height: 40;
- anchors.top: parent.top; anchors.left: parent.left;
- opacity: 0.9
- text: "Route"
- onClicked: { dialog.cancelButtonClicked() }
- }
+ item: Flickable {
+ id: f
- Column {
- id: options
- spacing: gap
- width: dialogRectangle.width - gap*2
-
- anchors {
- top: titleBar.bottom
- topMargin: gap
- left: dialogRectangle.left
- leftMargin: gap
- }
-
- states: [
- State {
- name: "Address"
- PropertyChanges { target: coord; enabled: false }
- PropertyChanges { target: address; enabled: true }
- }
- ]
+ clip: true
+ interactive: height + gap < contentHeight
+ implicitHeight: contentItem.height
+ contentHeight: contentItem.height
+ contentWidth: contentItem.width
+ Item {
+ id: contentItem
+ width: f.width
+ height: childrenRect.height
-//by coordinates
- Row {
- id: row1
+ Column {
+ id: options
spacing: gap
- Image {
- id: optionButtonCoord
- anchors.verticalCenter:parent.verticalCenter
- source: coord.enabled ? "../../resources/option_button_selected.png" : "../../resources/option_button.png"
- MouseArea {
- anchors.fill: parent
- onClicked: { options.state = "" }
- }
- }
+ width: parent.width
- Rectangle {
- id: coord
- color: enabled ? backgroundColorEnabled : backgroundColorDisabled
- radius: 5
- width:options.width - optionButtonCoord.width - row1.spacing
- height: longTo.y + longTo.height + gap
- enabled: true
-
-//start point
- Text {
- id: fromLabel;
- font.bold: true;
- enabled: coord.enabled
- anchors {
- top: latFrom.top
- topMargin:latFrom.height + gap/6 - fromLabel.height/2
- left: parent.left;
- leftMargin: gap
- }
- text: "From"
- color: enabled ? fontColorNormal : fontColorDisabled
- font.pixelSize: 14
+ states: [
+ State {
+ name: "Address"
+ PropertyChanges { target: coord; enabled: false }
+ PropertyChanges { target: address; enabled: true }
}
-
- TextWithLabel {
- id: latFrom
- width: parent.width - fromLabel.width - gap*3
- text: "-27.575"
- label: "latitude"
- enabled: coord.enabled
- anchors {
- left: fromLabel.right
- leftMargin: gap
- top: parent.top
- topMargin:gap
+ ]
+
+ //by coordinates
+ Row {
+ id: row1
+ spacing: gap
+ Image {
+ id: optionButtonCoord
+ anchors.verticalCenter:parent.verticalCenter
+ source: coord.enabled ? "../../resources/option_button_selected.png" : "../../resources/option_button.png"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { options.state = "" }
}
}
- TextWithLabel {
- id: longFrom
- width: latFrom.width
- text: "153.088"
- label: "longitude"
- enabled: coord.enabled
- anchors {
- left: latFrom.left
- top: latFrom.bottom
- topMargin:gap/3
+ Rectangle {
+ id: coord
+ color: enabled ? backgroundColorEnabled : backgroundColorDisabled
+ radius: 5
+ width:options.width - optionButtonCoord.width - row1.spacing
+ height: longTo.y + longTo.height + gap
+ enabled: true
+
+ //start point
+ Text {
+ id: fromLabel;
+ font.bold: true;
+ enabled: coord.enabled
+ anchors {
+ top: latFrom.top
+ topMargin:latFrom.height + gap/6 - fromLabel.height/2
+ left: parent.left;
+ leftMargin: gap
+ }
+ text: "From"
+ color: enabled ? fontColorNormal : fontColorDisabled
+ font.pixelSize: 14
}
- }
-//end point
- Text {
- id: toLabel;
- font.bold: true;
- width: fromLabel.width
- enabled: coord.enabled
- anchors {
- top: latTo.top
- topMargin:latTo.height + gap/6 - toLabel.height/2
- left: parent.left;
- leftMargin: gap;
+ TextWithLabel {
+ id: latFrom
+ width: parent.width - fromLabel.width - gap*3
+ text: "-27.575"
+ label: "latitude"
+ enabled: coord.enabled
+ anchors {
+ left: fromLabel.right
+ leftMargin: gap
+ top: parent.top
+ topMargin:gap
+ }
}
- text: "To"
- color: enabled ? fontColorNormal : fontColorDisabled
- font.pixelSize: 14
- }
- TextWithLabel {
- id: latTo
- width: latFrom.width
- text: "-27.465"
- label: "latitude"
- enabled: coord.enabled
- anchors {
- left: toLabel.right
- leftMargin: gap
- top: longFrom.bottom
- topMargin:gap
+ TextWithLabel {
+ id: longFrom
+ width: latFrom.width
+ text: "153.088"
+ label: "longitude"
+ enabled: coord.enabled
+ anchors {
+ left: latFrom.left
+ top: latFrom.bottom
+ topMargin:gap/3
+ }
}
- }
- TextWithLabel {
- id: longTo
- width: latTo.width
- text: "153.023"
- label: "longitude"
- enabled: coord.enabled
- anchors {
- left: latTo.left
- top: latTo.bottom
- topMargin:gap/3
+ //end point
+ Text {
+ id: toLabel;
+ font.bold: true;
+ width: fromLabel.width
+ enabled: coord.enabled
+ anchors {
+ top: latTo.top
+ topMargin:latTo.height + gap/6 - toLabel.height/2
+ left: parent.left;
+ leftMargin: gap;
+ }
+ text: "To"
+ color: enabled ? fontColorNormal : fontColorDisabled
+ font.pixelSize: 14
}
- }
- }
- }
-//by address
- Row {
- id: row2
- spacing: gap
+ TextWithLabel {
+ id: latTo
+ width: latFrom.width
+ text: "-27.465"
+ label: "latitude"
+ enabled: coord.enabled
+ anchors {
+ left: toLabel.right
+ leftMargin: gap
+ top: longFrom.bottom
+ topMargin:gap
+ }
+ }
- Image {
- id: optionButtonAddress
- source: address.enabled ? "../../resources/option_button_selected.png" : "../../resources/option_button.png"
- anchors.verticalCenter: parent.verticalCenter
- MouseArea {
- anchors.fill: parent
- onClicked: { options.state = "Address" }
+ TextWithLabel {
+ id: longTo
+ width: latTo.width
+ text: "153.023"
+ label: "longitude"
+ enabled: coord.enabled
+ anchors {
+ left: latTo.left
+ top: latTo.bottom
+ topMargin:gap/3
+ }
+ }
}
}
- Rectangle {
- id: address
- color: enabled ? backgroundColorEnabled : backgroundColorDisabled
- radius: 5
- width:coord.width
- height: countryTo.y + countryTo.height + gap
- enabled: false
-
-//start point
- Text {
- id: fromLabel2;
- font.bold: true;
- enabled: address.enabled
- anchors {
- top: cityFrom.top
- left: parent.left;
- leftMargin: gap
+ //by address
+ Row {
+ id: row2
+ spacing: gap
+
+ Image {
+ id: optionButtonAddress
+ source: address.enabled ? "../../resources/option_button_selected.png" : "../../resources/option_button.png"
+ anchors.verticalCenter: parent.verticalCenter
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { options.state = "Address" }
}
- text: "From"
- color: enabled ? fontColorNormal : fontColorDisabled
- font.pixelSize: 14
}
- TextWithLabel {
- id: streetFrom
- width: parent.width - fromLabel2.width - gap*3
- text: "Brandl st"
- label: "street"
- enabled: address.enabled
- anchors {
- left: fromLabel2.right
- leftMargin: gap
- top: parent.top
- topMargin:gap
+ Rectangle {
+ id: address
+ color: enabled ? backgroundColorEnabled : backgroundColorDisabled
+ radius: 5
+ width:coord.width
+ height: countryTo.y + countryTo.height + gap
+ enabled: false
+
+ //start point
+ Text {
+ id: fromLabel2;
+ font.bold: true;
+ enabled: address.enabled
+ anchors {
+ top: cityFrom.top
+ left: parent.left;
+ leftMargin: gap
+ }
+ text: "From"
+ color: enabled ? fontColorNormal : fontColorDisabled
+ font.pixelSize: 14
}
- }
- TextWithLabel {
- id: cityFrom
- width: streetFrom.width
- text: "Eight Mile Plains"
- label: "city"
- enabled: address.enabled
- anchors {
- left: streetFrom.left
- top: streetFrom.bottom
- topMargin:gap/3
+ TextWithLabel {
+ id: streetFrom
+ width: parent.width - fromLabel2.width - gap*3
+ text: "Brandl st"
+ label: "street"
+ enabled: address.enabled
+ anchors {
+ left: fromLabel2.right
+ leftMargin: gap
+ top: parent.top
+ topMargin:gap
+ }
}
- }
- TextWithLabel {
- id: countryFrom
- width: streetFrom.width
- text: "Australia"
- label: "country"
- enabled: address.enabled
- anchors {
- left: streetFrom.left
- top: cityFrom.bottom
- topMargin:gap/3
+ TextWithLabel {
+ id: cityFrom
+ width: streetFrom.width
+ text: "Eight Mile Plains"
+ label: "city"
+ enabled: address.enabled
+ anchors {
+ left: streetFrom.left
+ top: streetFrom.bottom
+ topMargin:gap/3
+ }
}
- }
+ TextWithLabel {
+ id: countryFrom
+ width: streetFrom.width
+ text: "Australia"
+ label: "country"
+ enabled: address.enabled
+ anchors {
+ left: streetFrom.left
+ top: cityFrom.bottom
+ topMargin:gap/3
+ }
+ }
-//end point
- Text {
- id: toLabel2;
- font.bold: true;
- enabled: address.enabled
- anchors {
- top: cityTo.top
- left: parent.left;
- leftMargin: gap
+ //end point
+ Text {
+ id: toLabel2;
+ font.bold: true;
+ enabled: address.enabled
+ anchors {
+ top: cityTo.top
+ left: parent.left;
+ leftMargin: gap
+ }
+ text: "To"
+ color: enabled ? fontColorNormal : fontColorDisabled
+ font.pixelSize: 14
}
- text: "To"
- color: enabled ? fontColorNormal : fontColorDisabled
- font.pixelSize: 14
- }
- TextWithLabel {
- id: streetTo
- width: parent.width - fromLabel2.width - gap*3
- text: "Heal st"
- label: "street"
- enabled: address.enabled
- anchors {
- left: fromLabel2.right
- leftMargin: gap
- top: countryFrom.bottom
- topMargin:gap
+ TextWithLabel {
+ id: streetTo
+ width: parent.width - fromLabel2.width - gap*3
+ text: "Heal st"
+ label: "street"
+ enabled: address.enabled
+ anchors {
+ left: fromLabel2.right
+ leftMargin: gap
+ top: countryFrom.bottom
+ topMargin:gap
+ }
}
- }
- TextWithLabel {
- id: cityTo
- width: streetTo.width
- text: "New Farm"
- label: "city"
- enabled: address.enabled
- anchors {
- left: streetTo.left
- top: streetTo.bottom
- topMargin:gap/3
+ TextWithLabel {
+ id: cityTo
+ width: streetTo.width
+ text: "New Farm"
+ label: "city"
+ enabled: address.enabled
+ anchors {
+ left: streetTo.left
+ top: streetTo.bottom
+ topMargin:gap/3
+ }
}
- }
- TextWithLabel {
- id: countryTo
- width: streetTo.width
- text: "Australia"
- label: "country"
- enabled: address.enabled
- anchors {
- left: streetTo.left
- top: cityTo.bottom
- topMargin:gap/3
+ TextWithLabel {
+ id: countryTo
+ width: streetTo.width
+ text: "Australia"
+ label: "country"
+ enabled: address.enabled
+ anchors {
+ left: streetTo.left
+ top: cityTo.bottom
+ topMargin:gap/3
+ }
}
}
}
}
- }
- Row {
- id: routeOptions
- anchors.top: options.bottom
- anchors.topMargin: gap
- anchors.left: parent.left
- anchors.leftMargin: gap
- width: parent.width - gap*2
- height: checkboxToll.height*2 + gap
- spacing: 0
- Column {//travel mode
- spacing: gap/3
- height: parent.height
- width: parent.width*0.325
- Optionbutton {
- id: optionbuttonVehicle
- width: parent.width
- text: "Vehicle"
- selected: true
- onClicked: {
- travelMode = RouteQuery.CarTravel
- optionbuttonPedestrian.selected = false
+ Row {
+ id: routeOptions
+ anchors.top: options.bottom
+ anchors.topMargin: gap
+ anchors.left: parent.left
+ anchors.leftMargin: gap
+ width: parent.width - gap*2
+ height: checkboxToll.height*2 + gap
+ spacing: 0
+ Column {//travel mode
+ spacing: gap/3
+ height: parent.height
+ width: parent.width*0.325
+ Optionbutton {
+ id: optionbuttonVehicle
+ width: parent.width
+ text: "Vehicle"
+ selected: true
+ onClicked: {
+ travelMode = RouteQuery.CarTravel
+ optionbuttonPedestrian.selected = false
+ }
}
- }
- Optionbutton {
- id: optionbuttonPedestrian
- width: parent.width
- text: "Pedestrian"
- onClicked: {
- travelMode = RouteQuery.PedestrianTravel
- optionbuttonVehicle.selected = false
+ Optionbutton {
+ id: optionbuttonPedestrian
+ width: parent.width
+ text: "Pedestrian"
+ onClicked: {
+ travelMode = RouteQuery.PedestrianTravel
+ optionbuttonVehicle.selected = false
+ }
}
}
- }
- Column {//Optimization
- spacing: gap/3
- height: parent.height
- width: parent.width*0.275
- Optionbutton {
- id: optionbuttonFastest
- width: parent.width
- text: "Fastest"
- selected: true
- onClicked: {
- routeOptimization = RouteQuery.FastestRoute
- optionbuttonShortest.selected = false
+ Column {//Optimization
+ spacing: gap/3
+ height: parent.height
+ width: parent.width*0.275
+ Optionbutton {
+ id: optionbuttonFastest
+ width: parent.width
+ text: "Fastest"
+ selected: true
+ onClicked: {
+ routeOptimization = RouteQuery.FastestRoute
+ optionbuttonShortest.selected = false
+ }
}
- }
- Optionbutton {
- id: optionbuttonShortest
- width: parent.width
- text: "Shortest"
- onClicked: {
- routeOptimization = RouteQuery.ShortestRoute
- optionbuttonFastest.selected = false
+ Optionbutton {
+ id: optionbuttonShortest
+ width: parent.width
+ text: "Shortest"
+ onClicked: {
+ routeOptimization = RouteQuery.ShortestRoute
+ optionbuttonFastest.selected = false
+ }
}
}
- }
-
- Column {//Route features
- id: routeFeatures
- spacing: gap/3
- height: parent.height
- width: parent.width*0.4
- Checkbox {
- id: checkboxToll
- width: parent.width
- text: "Avoid toll roads"
- onSelectedChanged: {routeFeatures.updateRouteFeatures()}
- }
- Checkbox {
- id: checkboxHighways
- width: parent.width
- text: "Avoid highways"
- onSelectedChanged: {routeFeatures.updateRouteFeatures()}
- }
-
- function updateRouteFeatures(){
- features = []
- var myArray = new Array()
+ Column {//Route features
+ id: routeFeatures
+ spacing: gap/3
+ height: parent.height
+ width: parent.width*0.4
+ Checkbox {
+ id: checkboxToll
+ width: parent.width
+ text: "Avoid toll roads"
+ onSelectedChanged: {routeFeatures.updateRouteFeatures()}
+ }
- if (checkboxToll.selected) myArray.push(RouteQuery.TollFeature)
- if (checkboxHighways.selected) myArray.push(RouteQuery.HighwayFeature)
+ Checkbox {
+ id: checkboxHighways
+ width: parent.width
+ text: "Avoid highways"
+ onSelectedChanged: {routeFeatures.updateRouteFeatures()}
+ }
- features = myArray
- }
- }
- }
+ function updateRouteFeatures(){
+ features = []
+ var myArray = new Array
+ if (checkboxToll.selected) myArray.push(RouteQuery.TollFeature)
+ if (checkboxHighways.selected) myArray.push(RouteQuery.HighwayFeature)
- Row {
- id: buttons
- anchors.top: routeOptions.bottom
- anchors.topMargin: gap
- anchors.horizontalCenter: parent.horizontalCenter
- spacing: gap/3
- height: 32
- Button {
- text: "Clear"
- width: 80; height: parent.height
- onClicked: {
- if (byCoordinates == true){
- latFrom.text = ""
- longFrom.text = ""
- latTo.text = ""
- longTo.text = ""
- }
- else {
- streetFrom.text = ""
- cityFrom.text = ""
- countryFrom.text = ""
- streetTo.text = ""
- cityTo.text = ""
- countryTo.text = ""
+ features = myArray
}
}
}
+ }
+ }
- Button {
- text: "Go!"
- width: 80; height: parent.height
- onClicked: {
- dialog.goButtonClicked ()
- }
- }
+ onClearButtonClicked: {
+ if (byCoordinates == true){
+ latFrom.text = ""
+ longFrom.text = ""
+ latTo.text = ""
+ longTo.text = ""
+ }
+ else {
+ streetFrom.text = ""
+ cityFrom.text = ""
+ countryFrom.text = ""
+ streetTo.text = ""
+ cityTo.text = ""
+ countryTo.text = ""
}
}
}
diff --git a/examples/declarative/mapviewer/mapviewer.qml b/examples/declarative/mapviewer/mapviewer.qml
index 4b8e467b..96e313fc 100644
--- a/examples/declarative/mapviewer/mapviewer.qml
+++ b/examples/declarative/mapviewer/mapviewer.qml
@@ -373,7 +373,7 @@ Item {
//Geocode Dialog
//! [geocode0]
- Dialog {
+ InputDialog {
id: geocodeDialog
//! [geocode0]
title: "Geocode"
@@ -417,7 +417,7 @@ Item {
//! [geocode2]
//Reverse Geocode Dialog
- Dialog {
+ InputDialog {
id: reverseGeocodeDialog
title: "Reverse Geocode"
z: backgroundRect.z + 2
@@ -447,7 +447,7 @@ Item {
}
//Get new coordinates for marker
- Dialog {
+ InputDialog {
id: coordinatesDialog
title: "New coordinates"
z: backgroundRect.z + 2
@@ -484,7 +484,7 @@ Item {
}
//Get new locale
- Dialog {
+ InputDialog {
id: localeDialog
title: "New Locale"
z: backgroundRect.z + 2
diff --git a/examples/declarative/places/content/places/CategoryDialog.qml b/examples/declarative/places/content/places/CategoryDialog.qml
index 33e6768a..15d27d44 100644
--- a/examples/declarative/places/content/places/CategoryDialog.qml
+++ b/examples/declarative/places/content/places/CategoryDialog.qml
@@ -42,7 +42,7 @@ import QtQuick 2.0
import QtLocation 5.0
import QtLocation.examples 5.0
-Dialog {
+InputDialog {
title: "Edit Category"
property Category category
diff --git a/examples/declarative/places/content/places/OptionsDialog.qml b/examples/declarative/places/content/places/OptionsDialog.qml
index 3fb6db2f..291a1d14 100644
--- a/examples/declarative/places/content/places/OptionsDialog.qml
+++ b/examples/declarative/places/content/places/OptionsDialog.qml
@@ -42,120 +42,54 @@ import QtQuick 2.0
import QtLocation 5.0
import QtLocation.examples 5.0
-Item {
+Dialog {
id: dialog
- property int gap: 10
- property int listItemHeight: titleBar.font.pixelSize * 1.5
property alias isFavoritesEnabled: enableFavoritesButton.selected
property alias locales: localesInput.text
+ property int listItemHeight: 21
- signal goButtonClicked
- signal cancelButtonClicked
+ title: "Options"
- opacity: 0
- anchors.fill: parent
+ item: Column {
+ id: options
+ width: parent.width
+ spacing: gap
- Fader{}
+ TextWithLabel {
+ id: localesInput
- Rectangle {
- id: dialogRectangle
- color: "#ECECEC"
- opacity: 1
- width: parent.width - gap
- height: titleBar.height + options.height + gap * 1.5
-
- anchors {
- verticalCenter: parent.verticalCenter
- left: parent.left
- leftMargin: gap/2
- }
-
- radius: 5
-
- TitleBar {
- id: titleBar;
- width: parent.width; height: 40;
- anchors.top: parent.top; anchors.left: parent.left;
- opacity: 0.9
- text: "Options"
-
- onClicked: { dialog.cancelButtonClicked() }
+ width: parent.width - gap
+ height: listItemHeight
+ label: "Locale(s)"
+ enabled: true
+ visible: placesPlugin.name != "" ? placesPlugin.supportsPlaces(Plugin.LocalizedPlacesFeature) : false;
}
- Column {
- id: options
- height: childrenRect.height
- width: parent.width
- spacing: gap
-
- anchors {
- top: titleBar.bottom
- topMargin: gap
- left: dialogRectangle.left
- right: dialogRectangle.right
- leftMargin: gap
- rightMargin: gap
- }
-
- TextWithLabel {
- id: localesInput
-
- width: parent.width - gap
- height: listItemHeight
- label: "Locale(s)"
- enabled: true
- visible: placesPlugin.name != "" ? placesPlugin.supportsPlaces(Plugin.LocalizedPlacesFeature) : false;
- }
+ Optionbutton {
+ id: enableFavoritesButton
- Optionbutton {
- id: enableFavoritesButton
-
- function resetVisibility() {
- if (placesPlugin.name !== "nokia_places_jsondb") {
- var pluginNames = placesPlugin.availableServiceProviders;
- for (var i= 0; i < pluginNames.length; ++i) {
- if (pluginNames[i] === "nokia_places_jsondb") {
- enableFavoritesButton.visible = true;
- return;
- }
+ function resetVisibility() {
+ if (placesPlugin.name !== "nokia_places_jsondb") {
+ var pluginNames = placesPlugin.availableServiceProviders;
+ for (var i = 0; i < pluginNames.length; ++i) {
+ if (pluginNames[i] === "nokia_places_jsondb") {
+ enableFavoritesButton.visible = true;
+ return;
}
}
- enableFavoritesButton.visible = false;
- }
-
- width: parent.width
- text: "Enable favorites"
- toggle: true
- visible: false
-
- Component.onCompleted: {
- resetVisibility();
- placesPlugin.nameChanged.connect(resetVisibility);
}
+ enableFavoritesButton.visible = false;
}
- Row {
- id: buttons
- anchors.horizontalCenter: parent.horizontalCenter
- spacing: gap/3
- height: 32
-
- Button {
- id: cancelButton
- text: "Cancel"
- width: 80; height: parent.height
-
- onClicked: dialog.cancelButtonClicked()
- }
-
- Button {
- id: okButton
- text: "Ok"
- width:80; height: parent.height
+ width: parent.width
+ text: "Enable favorites"
+ toggle: true
+ visible: false
- onClicked: dialog.goButtonClicked()
- }
+ Component.onCompleted: {
+ resetVisibility();
+ placesPlugin.nameChanged.connect(resetVisibility);
}
}
}
diff --git a/examples/declarative/places/content/places/PlaceDialog.qml b/examples/declarative/places/content/places/PlaceDialog.qml
index d983f8fa..71a7dd80 100644
--- a/examples/declarative/places/content/places/PlaceDialog.qml
+++ b/examples/declarative/places/content/places/PlaceDialog.qml
@@ -174,21 +174,22 @@ Dialog {
onOpacityChanged: {
if (opacity == 0)
- customLoader.item.currentIndex = 0
+ view.currentIndex = 0
}
ListModel {
id: dataFieldsModel
}
- customLoader.sourceComponent: ListView {
+ item: ListView {
id: view
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: 10
- height: Math.min(root.height * 0.6, flickable.contentHeight);
+ implicitHeight: flickable.contentHeight
+
spacing: gap/2
orientation: ListView.Horizontal
interactive: false
diff --git a/examples/declarative/places/places.qml b/examples/declarative/places/places.qml
index a773dd62..dc095f20 100644
--- a/examples/declarative/places/places.qml
+++ b/examples/declarative/places/places.qml
@@ -188,7 +188,7 @@ Item {
}
}
- Dialog {
+ InputDialog {
id: searchCenterDialog
z: backgroundRect.z + 4
@@ -220,7 +220,7 @@ Item {
}
}
- Dialog {
+ InputDialog {
id: searchBoxDialog
z: backgroundRect.z + 4
@@ -266,7 +266,7 @@ Item {
}
}
- Dialog {
+ InputDialog {
id: searchCircleDialog
z: backgroundRect.z + 4