Fixed Tree Selection Bug
This commit is contained in:
parent
41a7f6b380
commit
f0362cd37b
|
@ -247,29 +247,30 @@ void TreeItem::_propagate_check_through_parents(int p_column, bool p_emit_signal
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool all_unchecked_and_not_indeterminate = true;
|
bool any_checked = false;
|
||||||
bool any_unchecked_or_indeterminate = false;
|
bool any_unchecked = false;
|
||||||
|
bool any_indeterminate = false;
|
||||||
|
|
||||||
TreeItem *child_item = current->get_first_child();
|
TreeItem *child_item = current->get_first_child();
|
||||||
while (child_item) {
|
while (child_item) {
|
||||||
if (!child_item->is_checked(p_column)) {
|
if (!child_item->is_checked(p_column)) {
|
||||||
any_unchecked_or_indeterminate = true;
|
any_unchecked = true;
|
||||||
if (child_item->is_indeterminate(p_column)) {
|
if (child_item->is_indeterminate(p_column)) {
|
||||||
all_unchecked_and_not_indeterminate = false;
|
any_indeterminate = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
all_unchecked_and_not_indeterminate = false;
|
any_checked = true;
|
||||||
}
|
}
|
||||||
child_item = child_item->get_next();
|
child_item = child_item->get_next();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (all_unchecked_and_not_indeterminate) {
|
if (any_indeterminate || (any_checked && any_unchecked)) {
|
||||||
current->set_checked(p_column, false);
|
|
||||||
} else if (any_unchecked_or_indeterminate) {
|
|
||||||
current->set_indeterminate(p_column, true);
|
current->set_indeterminate(p_column, true);
|
||||||
|
} else if (current->is_indeterminate(p_column) && !any_checked) {
|
||||||
|
current->set_indeterminate(p_column, false);
|
||||||
} else {
|
} else {
|
||||||
current->set_checked(p_column, true);
|
current->set_checked(p_column, any_checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_emit_signal) {
|
if (p_emit_signal) {
|
||||||
|
|
Loading…
Reference in New Issue