|
@@ -4,9 +4,20 @@ import examples.simplechat 1.0
|
|
Rectangle {
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
anchors.fill: parent
|
|
color: "#303030"
|
|
color: "#303030"
|
|
|
|
+ onVisibleChanged: {
|
|
|
|
+ if(visible) {
|
|
|
|
+ _inputField.forceActiveFocus()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ MouseArea {
|
|
|
|
+ anchors.fill: parent
|
|
|
|
+ }
|
|
|
|
+
|
|
ListView {
|
|
ListView {
|
|
anchors.top: parent.top
|
|
anchors.top: parent.top
|
|
anchors.bottom: _inputField.top
|
|
anchors.bottom: _inputField.top
|
|
|
|
+ anchors.left: parent.left
|
|
|
|
+ anchors.right: parent.right
|
|
model: scEngine.messages
|
|
model: scEngine.messages
|
|
delegate: Item {
|
|
delegate: Item {
|
|
height: childrenRect.height
|
|
height: childrenRect.height
|
|
@@ -21,8 +32,10 @@ Rectangle {
|
|
|
|
|
|
Text {
|
|
Text {
|
|
anchors.left: _userName.right
|
|
anchors.left: _userName.right
|
|
|
|
+ anchors.right: parent.right
|
|
font.pointSize: 12
|
|
font.pointSize: 12
|
|
color: "#ffffff"
|
|
color: "#ffffff"
|
|
|
|
+ wrapMode: Text.Wrap
|
|
text: scEngine.getText(model.modelData.content)
|
|
text: scEngine.getText(model.modelData.content)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -33,9 +46,13 @@ Rectangle {
|
|
|
|
|
|
ChatInputField {
|
|
ChatInputField {
|
|
id: _inputField
|
|
id: _inputField
|
|
- anchors.left: parent.left
|
|
|
|
- anchors.right: parent.right
|
|
|
|
- anchors.bottom: parent.bottom
|
|
|
|
|
|
+ focus: true
|
|
|
|
+ anchors {
|
|
|
|
+ left: parent.left
|
|
|
|
+ right: parent.right
|
|
|
|
+ bottom: parent.bottom
|
|
|
|
+ margins: 20
|
|
|
|
+ }
|
|
placeholderText: qsTr("Start type here")
|
|
placeholderText: qsTr("Start type here")
|
|
onAccepted: {
|
|
onAccepted: {
|
|
scEngine.sendMessage(_inputField.text)
|
|
scEngine.sendMessage(_inputField.text)
|