1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 11:55:07 +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

@ -193,7 +193,7 @@ int main(int argc, char** argv)
if (process_table_view.selection().is_empty())
return -1;
auto pid_index = process_table_view.model()->index(process_table_view.selection().first().row(), column);
return process_table_view.model()->data(pid_index, GUI::ModelRole::Display).to_i32();
return pid_index.data().to_i32();
};
auto kill_action = GUI::Action::create("Kill process", { Mod_Ctrl, Key_K }, Gfx::Bitmap::load_from_file("/res/icons/kill16.png"), [&](const GUI::Action&) {
@ -342,7 +342,7 @@ public:
auto rect = a_rect.shrunken(2, 2);
auto percentage = index.data(GUI::ModelRole::Custom).to_i32();
auto data = index.data(GUI::ModelRole::Display);
auto data = index.data();
String text;
if (data.is_string())
text = data.as_string();