Simplify signals of TreeSearchPanel
This commit is contained in:
parent
1145ce0252
commit
af15dde4c8
|
@ -533,10 +533,8 @@ void TaskTree::_notification(int p_what) {
|
|||
tree->connect("multi_selected", callable_mp(this, &TaskTree::_on_item_selected).unbind(3), CONNECT_DEFERRED);
|
||||
tree->connect("item_activated", callable_mp(this, &TaskTree::_on_item_activated));
|
||||
tree->connect("item_collapsed", callable_mp(this, &TaskTree::_on_item_collapsed));
|
||||
// TODO: Simplify these signals into one (candidate names: changed, updated, update_requested):
|
||||
tree_search->search_panel->connect("text_changed", callable_mp(this, &TaskTree::_update_tree).unbind(1));
|
||||
tree_search->search_panel->connect("update_requested", callable_mp(this, &TaskTree::_update_tree));
|
||||
tree_search->search_panel->connect("visibility_changed", callable_mp(this, &TaskTree::_update_tree));
|
||||
tree_search->search_panel->connect("filter_toggled", callable_mp(this, &TaskTree::_update_tree));
|
||||
} break;
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
_do_update_theme_item_cache();
|
||||
|
|
|
@ -82,35 +82,30 @@ void TreeSearchPanel::_add_spacer(float p_width_multiplier) {
|
|||
add_child(spacer);
|
||||
}
|
||||
|
||||
void TreeSearchPanel::_emit_text_changed(const String &p_text) {
|
||||
this->emit_signal("text_changed", p_text);
|
||||
}
|
||||
|
||||
void TreeSearchPanel::_emit_text_submitted(const String &p_text) {
|
||||
this->emit_signal("text_submitted");
|
||||
}
|
||||
|
||||
void TreeSearchPanel::_emit_filter_toggled() {
|
||||
this->emit_signal("filter_toggled");
|
||||
void TreeSearchPanel::_emit_update_requested(){
|
||||
emit_signal("update_requested");
|
||||
}
|
||||
|
||||
void TreeSearchPanel::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_READY: {
|
||||
_initialize_controls();
|
||||
line_edit_search->connect("text_changed", callable_mp(this, &TreeSearchPanel::_emit_text_changed));
|
||||
line_edit_search->connect("text_changed", callable_mp(this, &TreeSearchPanel::_emit_update_requested).unbind(1));
|
||||
_initialize_close_callbacks();
|
||||
line_edit_search->connect("text_submitted", callable_mp(this, &TreeSearchPanel::_emit_text_submitted));
|
||||
check_button_filter_highlight->connect("pressed", callable_mp(this, &TreeSearchPanel::_emit_filter_toggled));
|
||||
check_button_filter_highlight->connect("pressed", callable_mp(this, &TreeSearchPanel::_emit_update_requested));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TreeSearchPanel::_bind_methods() {
|
||||
ADD_SIGNAL(MethodInfo("text_changed"));
|
||||
ADD_SIGNAL(MethodInfo("update_requested"));
|
||||
ADD_SIGNAL(MethodInfo("text_submitted"));
|
||||
ADD_SIGNAL(MethodInfo("filter_toggled"));
|
||||
}
|
||||
|
||||
TreeSearchPanel::TreeSearchPanel() {
|
||||
|
|
|
@ -53,9 +53,8 @@ private:
|
|||
void _add_spacer(float width_multiplier = 1.f);
|
||||
|
||||
void _on_draw_highlight(TreeItem *p_item, Rect2 p_rect);
|
||||
void _emit_text_changed(const String &p_text);
|
||||
void _emit_text_submitted(const String &p_text);
|
||||
void _emit_filter_toggled();
|
||||
void _emit_update_requested();
|
||||
void _notification(int p_what);
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Reference in New Issue