fix(@desktop/chats): Scroll chat to the bottom or last unread msg when chat is first time opening
This commit is contained in:
parent
940d8cd2c0
commit
36dc3e4c53
|
@ -1,8 +1,9 @@
|
||||||
import QtQuick 2.13
|
import QtQuick 2.14
|
||||||
import Qt.labs.platform 1.1
|
import Qt.labs.platform 1.1
|
||||||
import QtQuick.Controls 2.13
|
import QtQuick.Controls 2.14
|
||||||
import QtQuick.Layouts 1.13
|
import QtQuick.Layouts 1.14
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
|
import QtQml 2.14
|
||||||
import Qt.labs.qmlmodels 1.0
|
import Qt.labs.qmlmodels 1.0
|
||||||
|
|
||||||
import StatusQ.Core.Theme 0.1
|
import StatusQ.Core.Theme 0.1
|
||||||
|
@ -118,13 +119,25 @@ Item {
|
||||||
Repeater {
|
Repeater {
|
||||||
id: chatRepeater
|
id: chatRepeater
|
||||||
model: parentModule && parentModule.model
|
model: parentModule && parentModule.model
|
||||||
|
|
||||||
delegate: Loader {
|
delegate: Loader {
|
||||||
id: chatLoader
|
id: chatLoader
|
||||||
// Channels are not loaded by default and only load when first put active
|
|
||||||
active: model.active
|
// Channels/chats are not loaded by default and only load when first put active
|
||||||
visible: active
|
active: false
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
visible: model.active
|
||||||
|
|
||||||
|
// Removing the binding in order not to unload the content:
|
||||||
|
// It is done for keeping:
|
||||||
|
// - the last channel/chat scroll position
|
||||||
|
// - the last typed but not sent text
|
||||||
|
Binding on active {
|
||||||
|
when: !chatLoader.active
|
||||||
|
restoreMode: Binding.RestoreNone
|
||||||
|
value: model.itemId && root.isSectionActive && (model.itemId === root.activeChatId || model.itemId === root.activeSubItemId)
|
||||||
|
}
|
||||||
|
|
||||||
sourceComponent: ChatContentView {
|
sourceComponent: ChatContentView {
|
||||||
visible: !root.rootStore.openCreateChat && isActiveChannel
|
visible: !root.rootStore.openCreateChat && isActiveChannel
|
||||||
|
|
Loading…
Reference in New Issue