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
Notes: sideshowbarker 2024-07-19 03:33:02 +09:00
18 changed files with 56 additions and 57 deletions

View file

@ -118,7 +118,7 @@ ComboBox::ComboBox()
m_list_view->on_selection = [this](auto& index) {
ASSERT(model());
m_list_view->set_activates_on_selection(true);
auto new_value = model()->data(index).to_string();
auto new_value = index.data().to_string();
m_editor->set_text(new_value);
if (!m_only_allow_values_from_model)
m_editor->select_all();
@ -178,7 +178,7 @@ void ComboBox::open()
int longest_item_width = 0;
for (int i = 0; i < model()->row_count(); ++i) {
auto index = model()->index(i);
auto item_text = model()->data(index).to_string();
auto item_text = index.data().to_string();
longest_item_width = max(longest_item_width, m_list_view->font().width(item_text));
}
Gfx::IntSize size {