summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorabcd <amos.choy@nokia.com>2011-12-19 15:24:01 +1000
committerQt by Nokia <qt-info@nokia.com>2011-12-21 02:57:22 +0100
commitdf0106a250363e535ddfbff5486e9743e21dc49e (patch)
treefd4110c1f8b307df1ba4a9369484aa75e4e8e81d /examples
parent34e23060498f33308065e79d917355d59665474e (diff)
downloadqtlocation-df0106a250363e535ddfbff5486e9743e21dc49e.tar.gz
Add QML locale functionality to Places
Change-Id: I0380f3b6e7945909eee7c00230a976da0ac53d6e Reviewed-by: Aaron McCarthy <aaron.mccarthy@nokia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/declarative/places/content/places/SearchBox.qml8
-rw-r--r--examples/declarative/places/places.qml37
2 files changed, 37 insertions, 8 deletions
diff --git a/examples/declarative/places/content/places/SearchBox.qml b/examples/declarative/places/content/places/SearchBox.qml
index e27e29ce..72afa399 100644
--- a/examples/declarative/places/content/places/SearchBox.qml
+++ b/examples/declarative/places/content/places/SearchBox.qml
@@ -194,14 +194,6 @@ Rectangle {
visible: false
}
- //! [CategoryModel model]
- CategoryModel {
- id: categoryModel
- plugin: placesPlugin
- hierarchical: true
- }
- //! [CategoryModel model]
-
//! [PlaceSearchSuggestionModel view 1]
ListView {
id: suggestionView
diff --git a/examples/declarative/places/places.qml b/examples/declarative/places/places.qml
index 242e958a..4c3f15da 100644
--- a/examples/declarative/places/places.qml
+++ b/examples/declarative/places/places.qml
@@ -74,6 +74,7 @@ Item {
addItem("Provider");
addItem("New");
addItem("Goto");
+ addItem("Options");
}
onClicked: page.state = page.state == "" ? button : "";
@@ -215,6 +216,29 @@ Item {
}
}
+ Dialog {
+ id: optionsDialog
+ z: backgroundRect.z + 3
+
+ Behavior on opacity { NumberAnimation { duration: 500 } }
+
+ Component.onCompleted: prepareDialog()
+
+ function prepareDialog() {
+ setModel([
+ ["Locale(s)", placesPlugin.locales.toString()]
+ ]);
+ }
+
+ onCancelButtonClicked: page.state = ""
+ onGoButtonClicked: {
+ var locales = dialogModel.get(0).inputText.split(Qt.locale().groupSeparator);
+ placesPlugin.locales = locales;
+ categoryModel.update();
+ page.state = "";
+ }
+ }
+
BoundingCircle {
id: searchRegion
}
@@ -256,6 +280,14 @@ Item {
}
//! [PlaceRecommendationModel model]
+ //! [CategoryModel model]
+ CategoryModel {
+ id: categoryModel
+ plugin: placesPlugin
+ hierarchical: true
+ }
+ //! [CategoryModel model]
+
SearchBox {
id: searchBox
@@ -418,6 +450,11 @@ Item {
State {
name: "EditCategory"
PropertyChanges { target: editCategoryDialog; opacity: 1 }
+ },
+ State {
+ name: "Options"
+ PropertyChanges { target: optionsDialog; opacity: 1 }
+ StateChangeScript { script: optionsDialog.prepareDialog() }
}
]