diff options
author | Yann Bodson <yann.bodson@nokia.com> | 2009-10-30 06:20:45 (GMT) |
---|---|---|
committer | Yann Bodson <yann.bodson@nokia.com> | 2009-10-30 06:20:45 (GMT) |
commit | cc1b25a807e190b1b9fa10653e42e86f19d4bd0f (patch) | |
tree | f522374393bfd7afe24b4bcccf9bdd43e0d39e7a /demos/declarative/twitter/content/TitleBar.qml | |
parent | 9bbc155f0efe4bc873d7da4ac4ad844a6814c4e7 (diff) | |
download | Qt-cc1b25a807e190b1b9fa10653e42e86f19d4bd0f.zip Qt-cc1b25a807e190b1b9fa10653e42e86f19d4bd0f.tar.gz Qt-cc1b25a807e190b1b9fa10653e42e86f19d4bd0f.tar.bz2 |
make twitter not depend on flickr example
Diffstat (limited to 'demos/declarative/twitter/content/TitleBar.qml')
-rw-r--r-- | demos/declarative/twitter/content/TitleBar.qml | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/demos/declarative/twitter/content/TitleBar.qml b/demos/declarative/twitter/content/TitleBar.qml new file mode 100644 index 0000000..07b9762 --- /dev/null +++ b/demos/declarative/twitter/content/TitleBar.qml @@ -0,0 +1,76 @@ +import Qt 4.6 + +Item { + id: titleBar + property string untaggedString: "Uploads from everyone" + property string taggedString: "Recent uploads tagged " + + BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } + + Item { + id: container + width: (parent.width * 2) - 55 ; height: parent.height + + Script { + function accept() { + titleBar.state = "" + background.state = "" + rssModel.tags = editor.text + } + } + + Text { + id: categoryText + anchors { + left: parent.left; right: tagButton.left; leftMargin: 10; rightMargin: 10 + verticalCenter: parent.verticalCenter + } + elide: Text.ElideLeft + text: (rssModel.tags=="" ? untaggedString : taggedString + rssModel.tags) + font.bold: true; color: "White"; style: Text.Raised; styleColor: "Black" + } + + Button { + id: tagButton; x: titleBar.width - 50; width: 45; height: 32; text: "..." + onClicked: if (titleBar.state == "Tags") accept(); else titleBar.state = "Tags" + anchors.verticalCenter: parent.verticalCenter + } + + Item { + id: lineEdit + y: 4; height: parent.height - 9 + anchors { left: tagButton.right; leftMargin: 5; right: parent.right; rightMargin: 5 } + + BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } + + TextInput { + id: editor + anchors { + left: parent.left; right: parent.right; leftMargin: 10; rightMargin: 10 + verticalCenter: parent.verticalCenter + } + cursorVisible: true; font.bold: true + color: "#151515"; selectionColor: "Green" + } + + Keys.forwardTo: [ (returnKey), (editor)] + + Item { + id: returnKey + Keys.onReturnPressed: accept() + Keys.onEscapePressed: titleBar.state = "" + } + } + } + + states: State { + name: "Tags" + PropertyChanges { target: container; x: -tagButton.x + 5 } + PropertyChanges { target: tagButton; text: "OK" } + PropertyChanges { target: lineEdit; focus: true } + } + + transitions: Transition { + NumberAnimation { properties: "x"; easing: "easeInOutQuad" } + } +} |