Skip to content

Commit

Permalink
add send
Browse files Browse the repository at this point in the history
add keyboard listener, when press enter now you can send msg directly
  • Loading branch information
rangaofei committed Dec 18, 2021
1 parent 620b2b5 commit 9528124
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion qml/components/SendView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@ GroupBox{
border.color: buffer1.enabled ? "#bdbdbd" : "#bdbdbd"
radius: 3
}
Keys.onPressed: {
switch(event.key)
{
case Qt.Key_Return:
event.accepted=true;
sendMessageData.setPlainText(false)
sendMessage(buffer1.text)
break;
}
}

}
Image {
Layout.preferredHeight: 15
Expand Down Expand Up @@ -129,6 +140,16 @@ GroupBox{
border.color: buffer2.enabled ? "#bdbdbd" : "#bdbdbd"
radius: 3
}
Keys.onPressed: {
switch(event.key)
{
case Qt.Key_Return:
event.accepted=true;
sendMessageData.setPlainText(false)
sendMessage(buffer2.text)
break;
}
}
}
Image {
Layout.preferredHeight: 15
Expand Down Expand Up @@ -156,7 +177,6 @@ GroupBox{
}
onClicked: {
sendMessageData.setPlainText(false)

sendMessage(buffer2.text)
}
}
Expand Down Expand Up @@ -186,6 +206,16 @@ GroupBox{
border.color: buffer3.enabled ? "#bdbdbd" : "#bdbdbd"
radius: 3
}
Keys.onPressed: {
switch(event.key)
{
case Qt.Key_Return:
event.accepted=true;
sendMessageData.setPlainText(true)
sendMessage(buffer3.text)
break;
}
}
}
Image {
Layout.preferredHeight: 15
Expand Down

0 comments on commit 9528124

Please sign in to comment.