summaryrefslogtreecommitdiff
path: root/examples/declarative/mapviewer/Dialog.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/mapviewer/Dialog.qml')
-rw-r--r--examples/declarative/mapviewer/Dialog.qml93
1 files changed, 43 insertions, 50 deletions
diff --git a/examples/declarative/mapviewer/Dialog.qml b/examples/declarative/mapviewer/Dialog.qml
index 095db36d..586cc24e 100644
--- a/examples/declarative/mapviewer/Dialog.qml
+++ b/examples/declarative/mapviewer/Dialog.qml
@@ -52,33 +52,28 @@ Item {
property alias dialogModel: dialogModel
property alias length: dialogModel.count
property int gap: 20
- property int listItemHeight: 54
+ property int listItemHeight: 30
+
+ opacity: 0
function setModel(objects)
{
+ dialogModel.clear()
+
for (var i=0; i< objects.length; i++){
- dialogModel.append({"label": objects[i][0], "inputText": objects[i][1]})
+ dialogModel.append({"labelText": objects[i][0], "inputText": objects[i][1]})
}
}
- Rectangle {
- id: fader
- anchors.fill: parent
- opacity: 0.7
- color: "darkgrey"
- MouseArea {
- id: mouseArea
- anchors.fill: parent
- }
- }
+ Common.Fader {}
Rectangle {
id: dialogRectangle
color: "lightsteelblue"
- opacity: 1
+ opacity: parent.opacity
width: parent.width - gap;
- height: listview.height + titleBar.height + buttonGo.height + gap*2
+ height: listview.height + titleBar.height + buttons.height + gap*2
anchors {
top: parent.top
@@ -95,7 +90,7 @@ Item {
id: titleBar;
width: parent.width; height: 40;
anchors.top: parent.top; anchors.left: parent.left;
- opacity: 0.9; text: dialog.title;
+ opacity: 0.9
onClicked: { dialog.cancelButtonClicked() }
}
@@ -108,32 +103,16 @@ Item {
Column {
id: column1
height: listItemHeight
- Text { id: fieldTitle; text: label; height: 24;}
- Rectangle {
- id: inputRectangle
- width: dialogRectangle.width - gap; height: 30
- color: "whitesmoke"
- border.width: 1
- radius: 5
- TextInput {
- id: inputField
- text: inputText
- focus: true
- width: parent.width - anchors.leftMargin
-
- anchors {
- left: parent.left;
- verticalCenter: parent.verticalCenter;
- leftMargin: 5
- }
- onTextChanged:
- {
- dialogModel.set(index, {"inputText": text})
- }
- }
- MouseArea {
- anchors.fill: parent
- onClicked: inputField.forceActiveFocus();
+ TextWithLabel {
+ id: textWithLabel
+ label: labelText
+ text: inputText
+ width: dialogRectangle.width - gap
+ labelWidth: 75
+
+ onTextChanged:
+ {
+ dialogModel.set(index, {"inputText": text})
}
}
}
@@ -149,23 +128,37 @@ Item {
}
model: dialogModel
delegate: listDelegate
- spacing: gap
+ spacing: gap/2
interactive: false
Component.onCompleted: {
- height = (listItemHeight + gap)*length
+ height = (listItemHeight + gap/2)*length + gap/2
}
}
- Common.Button {
- id: buttonGo
- text: "Go!"
+ Row {
+ id: buttons
anchors.top: listview.bottom
- width: 80; height: 32
anchors.horizontalCenter: parent.horizontalCenter
- onClicked: {
- dialog.goButtonClicked ()
+ spacing: gap/3
+ height: 32
+ Common.Button {
+ id: buttonClearAll
+ text: "Clear All"
+ width: 80; height: parent.height
+ onClicked: {
+ for (var i = 0; i<length; i++){
+ dialogModel.set(i, {"inputText": ""})
+ }
+ }
+ }
+ Common.Button {
+ id: buttonGo
+ text: "Go!"
+ width: 80; height: parent.height
+ onClicked: {
+ dialog.goButtonClicked ()
+ }
}
}
}
}
-