1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:57:45 +00:00

LibGUI/AbstractView: Remove on_selection

Since the introduction of multi-select, we have had both `on_selection`
and `on_selection_change`, the latter of which was only invoked when a
change in selection came in through the model.

This removes `AbstractView::on_selection` and replaces it usage with
the more explicit `on_selection_change` everywhere.
This commit is contained in:
Jelle Raaijmakers 2021-05-25 22:48:43 +02:00 committed by Ali Mohammad Pur
parent ebe38639bc
commit 2c772d1848
12 changed files with 36 additions and 25 deletions

View file

@ -41,13 +41,15 @@ InspectorWidget::InspectorWidget()
auto& top_tab_widget = splitter.add<GUI::TabWidget>();
m_dom_tree_view = top_tab_widget.add_tab<GUI::TreeView>("DOM");
m_dom_tree_view->on_selection = [this](auto& index) {
m_dom_tree_view->on_selection_change = [this] {
const auto& index = m_dom_tree_view->selection().first();
auto* node = static_cast<Web::DOM::Node*>(index.internal_data());
set_inspected_node(node);
};
m_layout_tree_view = top_tab_widget.add_tab<GUI::TreeView>("Layout");
m_layout_tree_view->on_selection = [this](auto& index) {
m_layout_tree_view->on_selection_change = [this] {
const auto& index = m_layout_tree_view->selection().first();
auto* node = static_cast<Web::Layout::Node*>(index.internal_data());
set_inspected_node(node->dom_node());
};