1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 09:57:36 +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

@ -141,7 +141,8 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, const Vector<Position>& po
auto& type_list = left_side.add<GUI::ListView>();
type_list.set_model(*GUI::ItemListModel<String>::create(g_types));
type_list.set_should_hide_unnecessary_scrollbars(true);
type_list.on_selection = [&](auto& index) {
type_list.on_selection_change = [&] {
const auto& index = type_list.selection().first();
if (!index.is_valid()) {
m_type = nullptr;
return;