mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:57:44 +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:
parent
96f98b1fc9
commit
9102b624ac
18 changed files with 56 additions and 57 deletions
|
@ -142,7 +142,7 @@ Locator::~Locator()
|
|||
void Locator::open_suggestion(const GUI::ModelIndex& index)
|
||||
{
|
||||
auto filename_index = m_suggestion_view->model()->index(index.row(), LocatorSuggestionModel::Column::Name);
|
||||
auto filename = m_suggestion_view->model()->data(filename_index, GUI::ModelRole::Display).to_string();
|
||||
auto filename = filename_index.data().to_string();
|
||||
open_file(filename);
|
||||
close();
|
||||
}
|
||||
|
|
|
@ -225,7 +225,7 @@ int main(int argc, char** argv)
|
|||
auto selected_file_names = [&] {
|
||||
Vector<String> files;
|
||||
g_project_tree_view->selection().for_each_index([&](const GUI::ModelIndex& index) {
|
||||
files.append(g_project->model().data(index).as_string());
|
||||
files.append(index.data().as_string());
|
||||
});
|
||||
return files;
|
||||
};
|
||||
|
@ -478,7 +478,7 @@ int main(int argc, char** argv)
|
|||
toolbar.add_separator();
|
||||
|
||||
g_project_tree_view->on_activation = [&](auto& index) {
|
||||
auto filename = g_project_tree_view->model()->data(index, GUI::ModelRole::Custom).to_string();
|
||||
auto filename = index.data(GUI::ModelRole::Custom).to_string();
|
||||
open_file(filename);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue