1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:27: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

@ -143,7 +143,8 @@ int main(int argc, char** argv)
auto& disassembly_view = bottom_splitter.add<GUI::TableView>();
disassembly_view.set_visible(false);
tree_view.on_selection = [&](auto& index) {
tree_view.on_selection_change = [&] {
const auto& index = tree_view.selection().first();
profile->set_disassembly_index(index);
disassembly_view.set_model(profile->disassembly_model());
};
@ -161,7 +162,8 @@ int main(int argc, char** argv)
samples_table_view.set_model(profile->samples_model());
auto& individual_sample_view = samples_splitter.add<GUI::TableView>();
samples_table_view.on_selection = [&](const GUI::ModelIndex& index) {
samples_table_view.on_selection_change = [&] {
const auto& index = samples_table_view.selection().first();
auto model = IndividualSampleModel::create(*profile, index.data(GUI::ModelRole::Custom).to_integer<size_t>());
individual_sample_view.set_model(move(model));
};