2023-06-01 21:23:43 +00:00
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
|
|
|
SortFilterProxyModel {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property string searchText
|
|
|
|
readonly property string searchTextLowerCase: searchText.toLowerCase()
|
|
|
|
|
2023-07-05 15:17:51 +00:00
|
|
|
property int sortBy: TokenHoldersProxyModel.SortBy.Username
|
2023-06-01 21:23:43 +00:00
|
|
|
property int sortOrder: Qt.AscendingOrder
|
|
|
|
|
2023-07-05 15:17:51 +00:00
|
|
|
enum SortBy {
|
2023-08-22 15:34:37 +00:00
|
|
|
None, Username, NumberOfMessages, Holding
|
2023-07-05 15:17:51 +00:00
|
|
|
}
|
|
|
|
|
2023-06-01 21:23:43 +00:00
|
|
|
filters: ExpressionFilter {
|
|
|
|
expression: {
|
|
|
|
root.searchTextLowerCase
|
|
|
|
|
|
|
|
const nameLowerCase = model.name.toLowerCase()
|
|
|
|
const addressLowerCase = model.walletAddress.toLowerCase()
|
|
|
|
|
|
|
|
return nameLowerCase.includes(searchTextLowerCase) ||
|
|
|
|
addressLowerCase.includes(searchTextLowerCase)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sorters: [
|
|
|
|
FilterSorter {
|
2023-07-05 15:17:51 +00:00
|
|
|
enabled: root.sortBy === TokenHoldersProxyModel.SortBy.Username
|
2023-06-01 21:23:43 +00:00
|
|
|
|
|
|
|
ValueFilter {
|
|
|
|
roleName: "name"
|
|
|
|
value: ""
|
|
|
|
inverted: true
|
|
|
|
}
|
|
|
|
|
|
|
|
priority: 3
|
|
|
|
},
|
|
|
|
|
|
|
|
RoleSorter {
|
2023-07-05 15:17:51 +00:00
|
|
|
enabled: root.sortBy === TokenHoldersProxyModel.SortBy.Username
|
2023-06-01 21:23:43 +00:00
|
|
|
roleName: "name"
|
|
|
|
sortOrder: root.sortOrder
|
|
|
|
priority: 2
|
|
|
|
},
|
|
|
|
|
|
|
|
RoleSorter {
|
2023-07-05 15:17:51 +00:00
|
|
|
enabled: root.sortBy === TokenHoldersProxyModel.SortBy.Username
|
2023-06-01 21:23:43 +00:00
|
|
|
roleName: "walletAddress"
|
|
|
|
sortOrder: root.sortOrder
|
|
|
|
priority: 1
|
|
|
|
},
|
|
|
|
|
|
|
|
RoleSorter {
|
2023-08-22 15:34:37 +00:00
|
|
|
enabled: root.sortBy === TokenHoldersProxyModel.SortBy.NumberOfMessages
|
|
|
|
roleName: "numberOfMessages"
|
2023-06-01 21:23:43 +00:00
|
|
|
sortOrder: root.sortOrder
|
|
|
|
},
|
|
|
|
|
|
|
|
RoleSorter {
|
2023-07-05 15:17:51 +00:00
|
|
|
enabled: root.sortBy === TokenHoldersProxyModel.SortBy.Holding
|
2023-06-01 21:23:43 +00:00
|
|
|
roleName: "amount"
|
|
|
|
sortOrder: root.sortOrder
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|