anchors.right: parent.right
width: parent.width
// height: messageEditor.height > image.height ? messageEditor.height : image.height
- height: messageEditor.height
+ height: textEditRow.y + textEditRow.height + 3
+ clip: true
+
+ Rectangle {
+ id: charactersLeftRect
+ anchors.fill: charactersLeft
+ anchors.leftMargin: -4
+ anchors.rightMargin: anchors.leftMargin
+ border { color: "black"; width: 1 }
+ color: "white"
+ radius: 5
+ opacity: 0
+ Behavior on opacity { NumberAnimation { duration: animationDuration } }
+ }
+
+ Text {
+ id: charactersLeft
+ anchors.top: parent.top
+ anchors.horizontalCenter: messageEditorRect.horizontalCenter
+ font.pixelSize: 14
+ opacity: 0
+ Behavior on opacity { NumberAnimation { duration: animationDuration } }
+ }
+
+ Item {
+ id:textEditRow
+ anchors { left: parent.left; top: charactersLeftRect.bottom; topMargin: 2; right: parent.right }
+ height: messageEditor.height
+ }
Image {
id: image
- anchors { left: parent.left; top: parent.top }
+ anchors { left: parent.left; top: textEditRow.top }
}
Rectangle {
Behavior on opacity { NumberAnimation { duration: animationDuration } }
}
- TextEdit {
+ ExtendedTextEdit {
id: messageEditor
- anchors { leftMargin: 5; left: image.right; right: buttonsArea.left; rightMargin: 5; top: parent.top }
+ anchors { leftMargin: 5; left: image.right; right: buttonsArea.left; rightMargin: 5; top: textEditRow.top }
height: paintedHeight > buttonsArea.height ? paintedHeight : buttonsArea.height
- focus: true
- selectByMouse: true
- font.pixelSize: image.height * 0.7
- clip: true;
- wrapMode: TextEdit.Wrap
onActiveFocusChanged: {
- if (activeFocus) {
- console.log("messageEditor got focus")
+ if (activeFocus)
parent.state = "edit"
- } else {
- console.log("messageEditor lost focus")
- }
-
+ }
+ onCharacterCountChanged: {
+ charactersLeft.text = 255 - characterCount + " characters left"
}
}
Item {
id: buttonsArea
anchors {
- top: parent.top
+ top: textEditRow.top
right: cancelButton.right
left: cancelButton.right
- bottom: parent.top
+ bottom: textEditRow.top
}
}
opacity: 0.3
}
PropertyChanges {
+ target: charactersLeftRect
+ opacity: 0.3
+ }
+ PropertyChanges {
+ target: charactersLeft
+ opacity: 0.8
+ }
+ PropertyChanges {
target: cancelButton
scale: 1
}
AnchorChanges {
target: buttonsArea
anchors.left: cancelButton.left
- anchors.bottom: cancelButton.bottom
+ anchors.bottom: textEditRow.bottom
}
}
]
AnchorAnimation { targets: buttonsArea; duration: animationDuration }
NumberAnimation { target: messageEditor; properties: "height"; duration: animationDuration }
}
-
}
},
Transition {