mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-02 16:33:13 +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
Notes:
sideshowbarker
2024-07-19 03:33:02 +09:00
Author: https://github.com/awesomekling
Commit: 9102b624ac
18 changed files with 56 additions and 57 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue