summaryrefslogtreecommitdiffstats
path: root/QtDemo
diff options
context:
space:
mode:
authorKimmo Ollila <kimmo.ollila@digia.com>2013-06-10 17:34:47 +0300
committerLasse Räihä <lasse.raiha@digia.com>2013-06-11 07:56:00 +0300
commitf1165b18fa708d8a4d98272d9e971b1ec453ef9a (patch)
tree6031b707a06756391e7f24eab2dfacdc7f67cef3 /QtDemo
parent05d706a973587c2c72f46dc03bc9d07a6547d32e (diff)
Fixed tweetsearch line editing, rss font size decreased
Change-Id: Id5071de5bc4be17210e610adbb53ac98e86c985a Reviewed-by: Lasse Räihä <lasse.raiha@digia.com>
Diffstat (limited to 'QtDemo')
-rw-r--r--QtDemo/qml/QtDemo/demos/rssnews/content/NewsDelegate.qml6
-rw-r--r--QtDemo/qml/QtDemo/demos/tweetsearch/content/LineInput.qml39
2 files changed, 20 insertions, 25 deletions
diff --git a/QtDemo/qml/QtDemo/demos/rssnews/content/NewsDelegate.qml b/QtDemo/qml/QtDemo/demos/rssnews/content/NewsDelegate.qml
index 3274af8..4050af6 100644
--- a/QtDemo/qml/QtDemo/demos/rssnews/content/NewsDelegate.qml
+++ b/QtDemo/qml/QtDemo/demos/rssnews/content/NewsDelegate.qml
@@ -56,13 +56,15 @@ Item {
Text {
id: titleText
text: title; width: parent.width; wrapMode: Text.WordWrap
- font { bold: true; family: "Helvetica"; pointSize: 16 }
+ font { bold: true; family: "Helvetica"; pixelSize: 20}
}
Text {
id: descriptionText
width: parent.width; text: description
- wrapMode: Text.WordWrap; font.family: "Helvetica"
+ wrapMode: Text.WordWrap
+ font.family: "Helvetica"
+ font.pixelSize: 12
}
}
diff --git a/QtDemo/qml/QtDemo/demos/tweetsearch/content/LineInput.qml b/QtDemo/qml/QtDemo/demos/tweetsearch/content/LineInput.qml
index 6d5c215..213c0b6 100644
--- a/QtDemo/qml/QtDemo/demos/tweetsearch/content/LineInput.qml
+++ b/QtDemo/qml/QtDemo/demos/tweetsearch/content/LineInput.qml
@@ -43,9 +43,9 @@ import QtQuick 2.0
FocusScope {
id: wrapper
- property alias text: input.text
- property alias hint: hint.text
- property alias prefix: prefix.text
+ property string text: ""
+ property string hint: ""
+ property string prefix: ""
signal accepted
@@ -55,33 +55,26 @@ FocusScope {
color: "#c1c1c1"
radius: 4
- Text {
- id: hint
- anchors { fill: parent; leftMargin: 14 }
- verticalAlignment: Text.AlignVCenter
- text: "Enter word"
- font.pixelSize: 18
- color: "#707070"
- opacity: input.length ? 0 : 1
- }
-
- Text {
- id: prefix
- anchors { left: parent.left; leftMargin: 14; verticalCenter: parent.verticalCenter }
- verticalAlignment: Text.AlignVCenter
- font.pixelSize: 18
- color: "#707070"
- opacity: !hint.opacity
- }
-
TextInput {
id: input
focus: true
- anchors { left: prefix.right; right: parent.right; top: parent.top; bottom: parent.bottom }
+ anchors { left: parent.left; leftMargin:14; right: parent.right; top: parent.top; bottom: parent.bottom }
verticalAlignment: Text.AlignVCenter
font.pixelSize: 18
+ text: wrapper.hint
color: "#707070"
onAccepted: wrapper.accepted()
+ onActiveFocusChanged: {
+ if (focus) input.text = wrapper.hint
+ }
+
+ onTextChanged: {
+ if (text.length >= wrapper.hint.length+1 && text.substring(0, wrapper.hint.length)===wrapper.hint) {
+ var tmp = text.substring(wrapper.hint.length)
+ text = tmp
+ }
+ if (text !== "") wrapper.text = text
+ }
}
Rectangle {