Reduce useless setTypingState calls on lost focus
This commit is contained in:
parent
2e5b846695
commit
de9140cdb2
2
TODO.md
2
TODO.md
@ -47,7 +47,6 @@
|
|||||||
- Client improvements
|
- Client improvements
|
||||||
- Filtering rooms: search more than display names?
|
- Filtering rooms: search more than display names?
|
||||||
- nio.MatrixRoom has `typing_users`, no need to handle it on our own
|
- nio.MatrixRoom has `typing_users`, no need to handle it on our own
|
||||||
- Don't send setTypingState False when focus lost if nothing in sendbox
|
|
||||||
- Initial sync filter and lazy load, see weechat-matrix `_handle_login()`
|
- Initial sync filter and lazy load, see weechat-matrix `_handle_login()`
|
||||||
- See also `handle_response()`'s `keys_query` request
|
- See also `handle_response()`'s `keys_query` request
|
||||||
- HTTP/2
|
- HTTP/2
|
||||||
@ -64,6 +63,7 @@
|
|||||||
- Keep an accounts order
|
- Keep an accounts order
|
||||||
- See `Qt.callLater()` potential usages
|
- See `Qt.callLater()` potential usages
|
||||||
- Banner name color instead of bold
|
- Banner name color instead of bold
|
||||||
|
- Animate RoomEventDelegate DayBreak apparition
|
||||||
|
|
||||||
- Missing nio support
|
- Missing nio support
|
||||||
- MatrixRoom invited members list
|
- MatrixRoom invited members list
|
||||||
|
@ -31,13 +31,23 @@ HRectangle {
|
|||||||
backgroundColor: "transparent"
|
backgroundColor: "transparent"
|
||||||
area.focus: true
|
area.focus: true
|
||||||
|
|
||||||
|
property bool textChangedSinceLostFocus: false
|
||||||
|
|
||||||
function setTyping(typing) {
|
function setTyping(typing) {
|
||||||
Backend.clients.get(chatPage.userId)
|
Backend.clients.get(chatPage.userId)
|
||||||
.setTypingState(chatPage.roomId, typing)
|
.setTypingState(chatPage.roomId, typing)
|
||||||
}
|
}
|
||||||
|
|
||||||
onTextChanged: setTyping(Boolean(text))
|
onTextChanged: {
|
||||||
area.onEditingFinished: setTyping(false) // when lost focus
|
setTyping(Boolean(text))
|
||||||
|
textChangedSinceLostFocus = true
|
||||||
|
}
|
||||||
|
area.onEditingFinished: { // when lost focus
|
||||||
|
if (text && textChangedSinceLostFocus) {
|
||||||
|
setTyping(false)
|
||||||
|
textChangedSinceLostFocus = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Keys.onReturnPressed: {
|
Keys.onReturnPressed: {
|
||||||
event.accepted = true
|
event.accepted = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user