summaryrefslogtreecommitdiffstats
path: root/examples/declarative/searchbox
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2009-10-19 04:57:13 (GMT)
committerYann Bodson <yann.bodson@nokia.com>2009-10-19 04:57:13 (GMT)
commit99f0843947ebbf7d34f67142ad5cee57d4f5df6d (patch)
treee83638a97043862f6f0510343b04bb57066aa984 /examples/declarative/searchbox
parent55bddd50925da27f7a106041db44c15057aac6c1 (diff)
downloadQt-99f0843947ebbf7d34f67142ad5cee57d4f5df6d.zip
Qt-99f0843947ebbf7d34f67142ad5cee57d4f5df6d.tar.gz
Qt-99f0843947ebbf7d34f67142ad5cee57d4f5df6d.tar.bz2
modifications to searchbox example
Diffstat (limited to 'examples/declarative/searchbox')
-rw-r--r--examples/declarative/searchbox/SearchBox.qml35
-rw-r--r--examples/declarative/searchbox/images/edit-clear-locationbar-rtl.pngbin859 -> 429 bytes
2 files changed, 24 insertions, 11 deletions
diff --git a/examples/declarative/searchbox/SearchBox.qml b/examples/declarative/searchbox/SearchBox.qml
index 90d4367..7077a11 100644
--- a/examples/declarative/searchbox/SearchBox.qml
+++ b/examples/declarative/searchbox/SearchBox.qml
@@ -7,41 +7,54 @@ FocusScope {
BorderImage {
source: "images/lineedit-bg.png"
width: parent.width; height: parent.height
- border.left: 4; border.top: 4; border.right: 4; border.bottom: 4
+ border { left: 4; top: 4; right: 4; bottom: 4 }
}
BorderImage {
source: "images/lineedit-bg-focus.png"
width: parent.width; height: parent.height
- border.left: 4; border.top: 4; border.right: 4; border.bottom: 4
+ border { left: 4; top: 4; right: 4; bottom: 4 }
visible: parent.wantsFocus ? true : false
}
Text {
- anchors.fill: parent; anchors.leftMargin: 8
+ id: typeSomething; anchors.fill: parent; anchors.leftMargin: 8
verticalAlignment: Text.AlignVCenter
text: "Type something..."; color: "gray"; font.italic: true
- opacity: textInput.text == "" ? 1 : 0
- //opacity: Behavior { NumberAnimation { duration: 200 } }
}
MouseRegion { anchors.fill: parent; onClicked: focusScope.focus = true }
-
TextInput {
id: textInput
anchors.left: parent.left; anchors.leftMargin: 8
- //anchors.right: clear.left
anchors.verticalCenter: parent.verticalCenter
- focus: if(1) true
+ focus: if (1) true
}
+
Image {
id: clear
anchors.right: parent.right; anchors.rightMargin: 8
anchors.verticalCenter: parent.verticalCenter
- source: "images/edit-clear-locationbar-rtl.png"
- opacity: textInput.text == "" ? 0 : 1
- //opacity: Behavior { NumberAnimation { duration: 200 } }
+ source: "images/edit-clear-locationbar-rtl.png"; opacity: 0
+
MouseRegion { anchors.fill: parent; onClicked: { textInput.text = ''; focusScope.focus = true } }
}
+
+ states: State {
+ name: "hasText"; when: textInput.text != ''
+ PropertyChanges { target: typeSomething; opacity: 0 }
+ PropertyChanges { target: clear; opacity: 1 }
+ }
+
+ transitions: [
+ Transition {
+ from: ""; to: "hasText"
+ NumberAnimation { exclude: typeSomething; properties: "opacity" }
+ },
+ Transition {
+ from: "hasText"; to: ""
+ NumberAnimation { properties: "opacity" }
+ }
+ ]
}
diff --git a/examples/declarative/searchbox/images/edit-clear-locationbar-rtl.png b/examples/declarative/searchbox/images/edit-clear-locationbar-rtl.png
index 45ae477..91eb270 100644
--- a/examples/declarative/searchbox/images/edit-clear-locationbar-rtl.png
+++ b/examples/declarative/searchbox/images/edit-clear-locationbar-rtl.png
Binary files differ