--- /dev/null
+import Qt 4.7
+
+Item {
+ property alias image: image.source
+ property alias text: text.text
+
+ property int textSingleLineHeight: 0
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ width: childrenRect.width
+ height: text.height > image.height ? text.height : image.height
+
+ state: parent.state
+
+ Image {
+ id: image
+ anchors { left: parent.left; top: parent.top }
+ }
+
+ TextEdit {
+ id: text
+ anchors { leftMargin: 5; left: image.right; right: parent.right; top: parent.top }
+ focus: true
+ selectByMouse: true
+ font.pixelSize: image.height * 0.7
+ clip: true;
+// elide: Text.ElideRight
+ state: parent.state
+ Behavior on height {
+ id: textHeightBehavior
+ NumberAnimation { duration: 150 }
+ }
+ }
+
+ Component.onCompleted: {
+ textSingleLineHeight = text.height
+ }
+
+ states: [
+ State {
+ name: "expanded"
+ PropertyChanges {
+ target: text
+ height: paintedHeight
+ }
+ },
+ State {
+ name: ""
+ PropertyChanges {
+ target: text
+ explicit: true
+ height: textSingleLineHeight
+ }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: ""
+ to: "expanded"
+ SequentialAnimation {
+ PropertyAction { target: textHeightBehavior; property: "enabled"; value: true }
+ PropertyAction { target: text; property: "wrapMode"; value: Text.Wrap }
+ PropertyAction { target: text; property: "elide"; value: Text.ElideNone }
+ }
+ },
+ Transition {
+ from: "expanded"
+ to: ""
+ SequentialAnimation {
+ PropertyAction { target: textHeightBehavior; property: "enabled"; value: false }
+ NumberAnimation { target: text; properties: "height"; duration: 150 }
+ PropertyAction { target: text; property: "wrapMode"; value: Text.NoWrap }
+ PropertyAction { target: text; property: "elide"; value: Text.ElideRight }
+ }
+ }
+ ]
+}
Loader {
id: details
+ z: 1
sourceComponent: detailsComponent
state: parent.state
anchors { left: primaryText.left; right: primaryText.right; top: primaryText.bottom }
state: delegate.state
height: messageRow.height + addressRow.height + timeRow.height
width: parent.width
- DetailRow { id: messageRow; image: "qrc:/res/images/envelope.png"; text: userProfile.message }
+ DetailEditorRow { id: messageRow; image: "qrc:/res/images/envelope.png"; text: userProfile.message }
DetailRow { id: addressRow; anchors.top: messageRow.bottom; image: "qrc:/res/images/compass.png"; text: userProfile.address }
DetailRow { id: timeRow; anchors.top: addressRow.bottom; image: "qrc:/res/images/clock.png"; text: userProfile.time }
}