Reset composer when recycling chat page
This commit is contained in:
parent
82bcc29475
commit
99ae075bb4
|
@ -38,6 +38,10 @@ TextArea {
|
|||
text = Qt.binding(() => defaultText || "")
|
||||
}
|
||||
|
||||
function loadState() {
|
||||
if (! text) insertAtCursor(window.getState(this, "text", ""))
|
||||
}
|
||||
|
||||
function insertAtCursor(text) {
|
||||
insert(cursorPosition, text)
|
||||
}
|
||||
|
@ -87,9 +91,7 @@ TextArea {
|
|||
Component.onCompleted: {
|
||||
// Break binding
|
||||
previousDefaultText = previousDefaultText
|
||||
|
||||
// Set it only on component creation to avoid binding loops
|
||||
if (! text) insertAtCursor(window.getState(this, "text", ""))
|
||||
loadState()
|
||||
}
|
||||
|
||||
onTextChanged: window.saveState(this)
|
||||
|
|
|
@ -34,6 +34,10 @@ TextField {
|
|||
text = Qt.binding(() => defaultText || "")
|
||||
}
|
||||
|
||||
function loadState() {
|
||||
if (! text) insertAtCursor(window.getState(this, "text", ""))
|
||||
}
|
||||
|
||||
function insertAtCursor(text) {
|
||||
insert(cursorPosition, text)
|
||||
}
|
||||
|
@ -74,9 +78,7 @@ TextField {
|
|||
Component.onCompleted: {
|
||||
// Break binding
|
||||
previousDefaultText = previousDefaultText
|
||||
|
||||
// Set it only on component creation to avoid binding loops
|
||||
if (! text) insertAtCursor(window.getState(this, "text", ""))
|
||||
loadState()
|
||||
}
|
||||
|
||||
onTextChanged: window.saveState(this)
|
||||
|
|
|
@ -245,4 +245,13 @@ HTextArea {
|
|||
// )
|
||||
// }
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: pageLoader
|
||||
|
||||
function onRecycled() {
|
||||
area.reset()
|
||||
area.loadState()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user