diff options
author | Jelle Raaijmakers <jelle@gmta.nl> | 2021-05-25 22:48:43 +0200 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2021-05-26 17:39:13 +0430 |
commit | 2c772d184882dbdce0ec532f59c87743819f2e0d (patch) | |
tree | fd6bb1a769d1cd18140204b9d1c079ce18babf18 /Userland/DevTools | |
parent | ebe38639bcd8aac5302f969747796d940c5ab20b (diff) | |
download | serenity-2c772d184882dbdce0ec532f59c87743819f2e0d.zip |
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.
Diffstat (limited to 'Userland/DevTools')
-rw-r--r-- | Userland/DevTools/HackStudio/ClassViewWidget.cpp | 3 | ||||
-rw-r--r-- | Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp | 3 | ||||
-rw-r--r-- | Userland/DevTools/HackStudio/Git/GitWidget.cpp | 3 | ||||
-rw-r--r-- | Userland/DevTools/Profiler/main.cpp | 6 |
4 files changed, 10 insertions, 5 deletions
diff --git a/Userland/DevTools/HackStudio/ClassViewWidget.cpp b/Userland/DevTools/HackStudio/ClassViewWidget.cpp index 4f05ac67f6..9e8c9f6e4d 100644 --- a/Userland/DevTools/HackStudio/ClassViewWidget.cpp +++ b/Userland/DevTools/HackStudio/ClassViewWidget.cpp @@ -19,7 +19,8 @@ ClassViewWidget::ClassViewWidget() set_layout<GUI::VerticalBoxLayout>(); m_class_tree = add<GUI::TreeView>(); - m_class_tree->on_selection = [this](auto& index) { + m_class_tree->on_selection_change = [this] { + const auto& index = m_class_tree->selection().first(); if (!index.is_valid()) return; diff --git a/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp b/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp index f058c7d406..e626ff8a2a 100644 --- a/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp +++ b/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp @@ -65,7 +65,8 @@ DebugInfoWidget::DebugInfoWidget() variables_tab_widget.add_widget("Variables", build_variables_tab()); variables_tab_widget.add_widget("Registers", build_registers_tab()); - m_backtrace_view->on_selection = [this](auto& index) { + m_backtrace_view->on_selection_change = [this] { + const auto& index = m_backtrace_view->selection().first(); auto& model = static_cast<BacktraceModel&>(*m_backtrace_view->model()); // Note: The reconstruction of the register set here is obviously incomplete. diff --git a/Userland/DevTools/HackStudio/Git/GitWidget.cpp b/Userland/DevTools/HackStudio/Git/GitWidget.cpp index d2dc23ff21..39fb4a87f3 100644 --- a/Userland/DevTools/HackStudio/Git/GitWidget.cpp +++ b/Userland/DevTools/HackStudio/Git/GitWidget.cpp @@ -44,7 +44,8 @@ GitWidget::GitWidget(const LexicalPath& repo_root) m_unstaged_files = unstaged.add<GitFilesView>( [this](const auto& file) { stage_file(file); }, Gfx::Bitmap::load_from_file("/res/icons/16x16/plus.png").release_nonnull()); - m_unstaged_files->on_selection = [this](const GUI::ModelIndex& index) { + m_unstaged_files->on_selection_change = [this] { + const auto& index = m_unstaged_files->selection().first(); const auto& selected = index.data().as_string(); show_diff(LexicalPath(selected)); }; diff --git a/Userland/DevTools/Profiler/main.cpp b/Userland/DevTools/Profiler/main.cpp index 6f85fef7a0..c40c95b139 100644 --- a/Userland/DevTools/Profiler/main.cpp +++ b/Userland/DevTools/Profiler/main.cpp @@ -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)); }; |