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
await asyncio.sleep(0.1)
print( self.lazy_load_filter)
response = await self.room_messages(
room_id = room_id,
start = self.past_tokens[room_id],

View File

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

View File

@ -14,7 +14,17 @@ HColumnLayout {
id: memberList
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")
filters: ExpressionFilter {
@ -24,13 +34,6 @@ HColumnLayout {
}
}
delegate: MemberDelegate {
width: memberList.width
}
Layout.fillWidth: true
Layout.fillHeight: true
Rectangle {
anchors.fill: parent
z: -100