Use filtered model strictly when neccessary

This commit is contained in:
miruka 2020-04-15 16:54:24 -04:00
parent 01adcff77e
commit 99d59bb49b
3 changed files with 26 additions and 31 deletions

View File

@ -761,7 +761,6 @@ class MatrixClient(nio.AsyncClient):
# If a new room was added, wait for onSyncResponse to set the token # If a new room was added, wait for onSyncResponse to set the token
await asyncio.sleep(0.1) await asyncio.sleep(0.1)
print( self.lazy_load_filter)
response = await self.room_messages( response = await self.room_messages(
room_id = room_id, room_id = room_id,
start = self.past_tokens[room_id], start = self.past_tokens[room_id],

View File

@ -21,8 +21,6 @@ Column {
readonly property alias collapsed: account.collapsed readonly property alias collapsed: account.collapsed
readonly property alias roomList: roomList readonly property alias roomList: roomList
onFirstSyncDoneChanged: print("fsd")
Account { Account {
id: account id: account
@ -39,29 +37,16 @@ Column {
height: contentHeight height: contentHeight
interactive: false interactive: false
model: HSortFilterProxyModel { // https://github.com/oKcerG/SortFilterProxyModel/issues/75
sourceModel: ModelStore.get(accountRooms.userId, "rooms") model:
mainPane.filter ? proxy :
filters: [ account.collapsed ? null :
ExpressionFilter { proxy.sourceModel
expression: ! account.collapsed
enabled: ! mainPane.filter
},
ExpressionFilter {
expression: utils.filterMatches(
mainPane.filter, model.display_name,
)
}
]
}
delegate: HLoader { delegate: HLoader {
asynchronous: false asynchronous: false
active: firstSyncDone && inView active: firstSyncDone && inView
onInViewChanged: print("iv")
width: roomList.width width: roomList.width
height: roomList.firstDelegateHeight height: roomList.firstDelegateHeight
@ -95,8 +80,6 @@ Column {
contentItem.visibleChildren[0] ? contentItem.visibleChildren[0] ?
contentItem.visibleChildren[0].implicitHeight : contentItem.visibleChildren[0].implicitHeight :
0 0
property var pr: firstDelegateHeight
onPrChanged: print("pr changed:", pr)
readonly property bool hasActiveRoom: readonly property bool hasActiveRoom:
window.uiState.page === "Pages/Chat/Chat.qml" && window.uiState.page === "Pages/Chat/Chat.qml" &&
@ -106,6 +89,16 @@ Column {
hasActiveRoom ? hasActiveRoom ?
model.findIndex(window.uiState.pageProperties.roomId) : null model.findIndex(window.uiState.pageProperties.roomId) : null
readonly property HSortFilterProxyModel proxy: HSortFilterProxyModel {
sourceModel: ModelStore.get(accountRooms.userId, "rooms")
filters: ExpressionFilter {
expression: utils.filterMatches(
mainPane.filter, model.display_name,
)
}
}
Binding on currentIndex { Binding on currentIndex {
value: value:

View File

@ -14,7 +14,17 @@ HColumnLayout {
id: memberList id: memberList
clip: true clip: true
model: HSortFilterProxyModel { // https://github.com/oKcerG/SortFilterProxyModel/issues/75
model: filterField.text ? proxy : proxy.sourceModel
delegate: MemberDelegate {
width: memberList.width
}
Layout.fillWidth: true
Layout.fillHeight: true
readonly property HSortFilterProxyModel proxy: HSortFilterProxyModel {
sourceModel: ModelStore.get(chat.userId, chat.roomId, "members") sourceModel: ModelStore.get(chat.userId, chat.roomId, "members")
filters: ExpressionFilter { filters: ExpressionFilter {
@ -24,13 +34,6 @@ HColumnLayout {
} }
} }
delegate: MemberDelegate {
width: memberList.width
}
Layout.fillWidth: true
Layout.fillHeight: true
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
z: -100 z: -100