1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:47:47 +00:00

LibGUI+DevTools+Applications: Use ModelIndex::data() in many places

This way you don't have to keep track of which model it came from.
This commit is contained in:
Andreas Kling 2020-08-16 16:14:39 +02:00
parent 96f98b1fc9
commit 9102b624ac
18 changed files with 56 additions and 57 deletions

View file

@ -326,7 +326,7 @@ void DirectoryView::update_statusbar()
current_view().selection().for_each_index([&](auto& index) {
auto& model = *current_view().model();
auto size_index = model.index(index.row(), GUI::FileSystemModel::Column::Size, model.parent_index(index));
auto file_size = model.data(size_index).to_i32();
auto file_size = size_index.data().to_i32();
selected_byte_count += file_size;
});

View file

@ -438,7 +438,7 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
view.selection().for_each_index([&](const GUI::ModelIndex& index) {
auto parent_index = model.parent_index(index);
auto name_index = model.index(index.row(), GUI::FileSystemModel::Column::Name, parent_index);
auto path = model.data(name_index, GUI::ModelRole::Custom).to_string();
auto path = name_index.data(GUI::ModelRole::Custom).to_string();
paths.append(path);
});
return paths;