More efficiant roomList delegate in view detection
This commit is contained in:
parent
ecb88864a9
commit
8b02f0e462
|
@ -45,20 +45,15 @@ Column {
|
||||||
|
|
||||||
delegate: HLoader {
|
delegate: HLoader {
|
||||||
asynchronous: false
|
asynchronous: false
|
||||||
active: firstSyncDone && inView
|
active: index === 0 || (
|
||||||
|
roomList.firstDelegateHeight !== 0 &&
|
||||||
|
index >= roomList.firstIndexInView &&
|
||||||
|
index <= roomList.lastIndexInView
|
||||||
|
)
|
||||||
|
|
||||||
width: roomList.width
|
width: roomList.width
|
||||||
height: roomList.firstDelegateHeight
|
height: roomList.firstDelegateHeight
|
||||||
|
|
||||||
// XXX: these assume the view has no spacing/margins/header/footer
|
|
||||||
readonly property int yTop:
|
|
||||||
accountRooms.y + account.height + accountRooms.spacing +
|
|
||||||
model.index * height
|
|
||||||
readonly property int yBottom: yTop + height
|
|
||||||
readonly property bool inView:
|
|
||||||
yBottom >= mainPaneList.contentY &&
|
|
||||||
yTop <= mainPaneList.contentY + mainPaneList.height
|
|
||||||
|
|
||||||
readonly property var sourceModel: model
|
readonly property var sourceModel: model
|
||||||
|
|
||||||
sourceComponent: Room {
|
sourceComponent: Room {
|
||||||
|
@ -71,7 +66,9 @@ Column {
|
||||||
|
|
||||||
highlight: null // managed by the AccountRoomsList
|
highlight: null // managed by the AccountRoomsList
|
||||||
|
|
||||||
onFirstDelegateHeightChanged: firstDelegateHeight = firstDelegateHeight
|
onFirstDelegateHeightChanged:
|
||||||
|
if (firstDelegateHeight !== 0)
|
||||||
|
firstDelegateHeight = firstDelegateHeight
|
||||||
|
|
||||||
|
|
||||||
// Delete 0 must *always* be loaded, and all delegates must have the
|
// Delete 0 must *always* be loaded, and all delegates must have the
|
||||||
|
@ -81,6 +78,14 @@ Column {
|
||||||
contentItem.visibleChildren[0].implicitHeight :
|
contentItem.visibleChildren[0].implicitHeight :
|
||||||
0
|
0
|
||||||
|
|
||||||
|
readonly property int firstIndexInView:
|
||||||
|
(mainPaneList.contentY - account.height - accountRooms.spacing) /
|
||||||
|
firstDelegateHeight -
|
||||||
|
accountRooms.y / firstDelegateHeight
|
||||||
|
|
||||||
|
readonly property int lastIndexInView:
|
||||||
|
firstIndexInView + mainPaneList.height / firstDelegateHeight
|
||||||
|
|
||||||
readonly property bool hasActiveRoom:
|
readonly property bool hasActiveRoom:
|
||||||
window.uiState.page === "Pages/Chat/Chat.qml" &&
|
window.uiState.page === "Pages/Chat/Chat.qml" &&
|
||||||
window.uiState.pageProperties.userId === userId
|
window.uiState.pageProperties.userId === userId
|
||||||
|
|
|
@ -13,9 +13,9 @@ HTileDelegate {
|
||||||
opacity:
|
opacity:
|
||||||
model.left ? theme.mainPane.listView.room.leftRoomOpacity : 1
|
model.left ? theme.mainPane.listView.room.leftRoomOpacity : 1
|
||||||
|
|
||||||
topPadding: theme.spacing / (model.index === 0 ? 1 : 1.5)
|
// topPadding: theme.spacing / (model.index === 0 ? 1 : 1.5)
|
||||||
bottomPadding:
|
// bottomPadding:
|
||||||
theme.spacing / (model.index === view.count - 1 ? 1 : 1.5)
|
// theme.spacing / (model.index === view.count - 1 ? 1 : 1.5)
|
||||||
leftPadding: theme.spacing * 2
|
leftPadding: theme.spacing * 2
|
||||||
rightPadding: theme.spacing
|
rightPadding: theme.spacing
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user