Skip to content

Commit

Permalink
Refs #19743: [ARS] Refactor tree model filtering
Browse files Browse the repository at this point in the history
Signed-off-by: JesusPoderoso <[email protected]>
  • Loading branch information
JesusPoderoso committed Nov 13, 2023
1 parent ebcdc84 commit 0c1917b
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions qml/StatusTreeView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ Flickable {
Arrow
}

property int current_filter_: -2 // backend::ID_ALL
readonly property int filter_all_: -2 // backend::ID_ALL
property int current_filter_: filter_all_
signal entity_status_filtered()

property int handleStyle: StatusTreeView.Handle.TriangleSmallOutline
Expand All @@ -106,7 +107,7 @@ Flickable {
{
target: root.model
function onLayoutChanged() {
root.filter_model()
root.filter_model_by_id(root.current_filter_)
}
}

Expand Down Expand Up @@ -176,26 +177,18 @@ Flickable {

function clean_filter()
{
root.filter_model()
model.filter_proxy(-2)
root.filter_model_by_id(filter_all_)
tree.unfilter()
}

function filter_model()
function filter_model_by_id(entityId)
{
var filter_all = -2 // backend::ID_ALL

if (current_filter_ != filter_all)
if (current_filter_ != entityId)
{
current_filter_ = filter_all
root.filter_model_by_id(current_filter_)
current_filter_ = entityId
}
}

function filter_model_by_id(entityId)
{
model.filter_proxy(entityId)
model.filter_proxy(current_filter_)
root.entity_status_filtered()
tree.filter(entityId)
tree.filter(current_filter_)
}
}

0 comments on commit 0c1917b

Please sign in to comment.