Update SortFilterProxyModel and fix #92.
This commit is contained in:
parent
7af8ce9920
commit
db59d035a9
|
@ -21,7 +21,6 @@ Rectangle {
|
||||||
roomContextMenu.popup()
|
roomContextMenu.popup()
|
||||||
}
|
}
|
||||||
onPrimaryClicked: {
|
onPrimaryClicked: {
|
||||||
listView.currentIndex = index
|
|
||||||
if (category === RoomType.Invited) {
|
if (category === RoomType.Invited) {
|
||||||
inviteDialog.currentRoom = currentRoom
|
inviteDialog.currentRoom = currentRoom
|
||||||
inviteDialog.open()
|
inviteDialog.open()
|
||||||
|
|
|
@ -4,17 +4,53 @@ import QtQuick.Controls 2.2
|
||||||
import SortFilterProxyModel 0.2
|
import SortFilterProxyModel 0.2
|
||||||
|
|
||||||
RoomListPanelForm {
|
RoomListPanelForm {
|
||||||
sortedRoomListModel.proxyRoles: ExpressionRole {
|
model: sortedRoomListModel
|
||||||
name: "display"
|
|
||||||
expression: {
|
SortFilterProxyModel {
|
||||||
switch (category) {
|
id: sortedRoomListModel
|
||||||
case 1: return "Invited"
|
|
||||||
case 2: return "Favorites"
|
sourceModel: listModel
|
||||||
case 3: return "Rooms"
|
|
||||||
case 4: return "People"
|
proxyRoles: ExpressionRole {
|
||||||
case 5: return "Low Priority"
|
name: "display"
|
||||||
|
expression: {
|
||||||
|
switch (category) {
|
||||||
|
case 1: return "Invited"
|
||||||
|
case 2: return "Favorites"
|
||||||
|
case 3: return "Rooms"
|
||||||
|
case 4: return "People"
|
||||||
|
case 5: return "Low Priority"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sorters: [
|
||||||
|
RoleSorter { roleName: "category" },
|
||||||
|
RoleSorter {
|
||||||
|
roleName: "lastActiveTime"
|
||||||
|
sortOrder: Qt.DescendingOrder
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
filters: [
|
||||||
|
RegExpFilter {
|
||||||
|
roleName: "name"
|
||||||
|
pattern: searchField.text
|
||||||
|
caseSensitivity: Qt.CaseInsensitive
|
||||||
|
},
|
||||||
|
ExpressionFilter {
|
||||||
|
enabled: filter === 1
|
||||||
|
expression: unreadCount > 0
|
||||||
|
},
|
||||||
|
ExpressionFilter {
|
||||||
|
enabled: filter === 2
|
||||||
|
expression: category === 1 || category === 2 || category === 4
|
||||||
|
},
|
||||||
|
ExpressionFilter {
|
||||||
|
enabled: filter === 3
|
||||||
|
expression: category === 3 || category === 5
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
Shortcut {
|
Shortcut {
|
||||||
|
|
|
@ -16,12 +16,12 @@ import SortFilterProxyModel 0.2
|
||||||
import "qrc:/js/util.js" as Util
|
import "qrc:/js/util.js" as Util
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
property alias listModel: sortedRoomListModel.sourceModel
|
property var listModel
|
||||||
property int filter: 0
|
property int filter: 0
|
||||||
property var enteredRoom: null
|
property var enteredRoom: null
|
||||||
|
|
||||||
property alias searchField: searchField
|
property alias searchField: searchField
|
||||||
property alias sortedRoomListModel: sortedRoomListModel
|
property alias model: listView.model
|
||||||
|
|
||||||
color: MSettings.darkTheme ? "#323232" : "#f3f3f3"
|
color: MSettings.darkTheme ? "#323232" : "#f3f3f3"
|
||||||
|
|
||||||
|
@ -56,44 +56,6 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SortFilterProxyModel {
|
|
||||||
id: sortedRoomListModel
|
|
||||||
|
|
||||||
sorters: [
|
|
||||||
RoleSorter { roleName: "category" },
|
|
||||||
RoleSorter {
|
|
||||||
roleName: "lastActiveTime"
|
|
||||||
sortOrder: Qt.DescendingOrder
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
SortFilterProxyModel {
|
|
||||||
id: roomListProxyModel
|
|
||||||
|
|
||||||
sourceModel: sortedRoomListModel
|
|
||||||
|
|
||||||
filters: [
|
|
||||||
RegExpFilter {
|
|
||||||
roleName: "name"
|
|
||||||
pattern: searchField.text
|
|
||||||
caseSensitivity: Qt.CaseInsensitive
|
|
||||||
},
|
|
||||||
ExpressionFilter {
|
|
||||||
enabled: filter === 1
|
|
||||||
expression: unreadCount > 0
|
|
||||||
},
|
|
||||||
ExpressionFilter {
|
|
||||||
enabled: filter === 2
|
|
||||||
expression: category === 1 || category === 2 || category === 4
|
|
||||||
},
|
|
||||||
ExpressionFilter {
|
|
||||||
enabled: filter === 3
|
|
||||||
expression: category === 3 || category === 5
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
AutoListView {
|
AutoListView {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
@ -103,15 +65,6 @@ Rectangle {
|
||||||
spacing: 1
|
spacing: 1
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
model: roomListProxyModel
|
|
||||||
|
|
||||||
currentIndex: -1
|
|
||||||
|
|
||||||
highlightFollowsCurrentItem: true
|
|
||||||
|
|
||||||
highlightMoveDuration: 200
|
|
||||||
highlightResizeDuration: 0
|
|
||||||
|
|
||||||
boundsBehavior: Flickable.DragOverBounds
|
boundsBehavior: Flickable.DragOverBounds
|
||||||
|
|
||||||
ScrollBar.vertical: ScrollBar {}
|
ScrollBar.vertical: ScrollBar {}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 1efea2b6003dcc23e0b0d9787cbdef2cf557636d
|
Subproject commit c558ef25f6d7f05cb6c4b2afdd8b0a2783288322
|
Loading…
Reference in New Issue