Reset composer when recycling chat page
This commit is contained in:
parent
82bcc29475
commit
99ae075bb4
@ -38,6 +38,10 @@ TextArea {
|
|||||||
text = Qt.binding(() => defaultText || "")
|
text = Qt.binding(() => defaultText || "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function loadState() {
|
||||||
|
if (! text) insertAtCursor(window.getState(this, "text", ""))
|
||||||
|
}
|
||||||
|
|
||||||
function insertAtCursor(text) {
|
function insertAtCursor(text) {
|
||||||
insert(cursorPosition, text)
|
insert(cursorPosition, text)
|
||||||
}
|
}
|
||||||
@ -87,9 +91,7 @@ TextArea {
|
|||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
// Break binding
|
// Break binding
|
||||||
previousDefaultText = previousDefaultText
|
previousDefaultText = previousDefaultText
|
||||||
|
loadState()
|
||||||
// Set it only on component creation to avoid binding loops
|
|
||||||
if (! text) insertAtCursor(window.getState(this, "text", ""))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onTextChanged: window.saveState(this)
|
onTextChanged: window.saveState(this)
|
||||||
|
@ -34,6 +34,10 @@ TextField {
|
|||||||
text = Qt.binding(() => defaultText || "")
|
text = Qt.binding(() => defaultText || "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function loadState() {
|
||||||
|
if (! text) insertAtCursor(window.getState(this, "text", ""))
|
||||||
|
}
|
||||||
|
|
||||||
function insertAtCursor(text) {
|
function insertAtCursor(text) {
|
||||||
insert(cursorPosition, text)
|
insert(cursorPosition, text)
|
||||||
}
|
}
|
||||||
@ -74,9 +78,7 @@ TextField {
|
|||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
// Break binding
|
// Break binding
|
||||||
previousDefaultText = previousDefaultText
|
previousDefaultText = previousDefaultText
|
||||||
|
loadState()
|
||||||
// Set it only on component creation to avoid binding loops
|
|
||||||
if (! text) insertAtCursor(window.getState(this, "text", ""))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onTextChanged: window.saveState(this)
|
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