mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 20:34:59 +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
|
@ -134,7 +134,7 @@ void AbstractView::begin_editing(const ModelIndex& index)
|
|||
ASSERT(aid_create_editing_delegate);
|
||||
m_editing_delegate = aid_create_editing_delegate(index);
|
||||
m_editing_delegate->bind(*model(), index);
|
||||
m_editing_delegate->set_value(model()->data(index, ModelRole::Display));
|
||||
m_editing_delegate->set_value(index.data());
|
||||
m_edit_widget = m_editing_delegate->widget();
|
||||
add_child(*m_edit_widget);
|
||||
m_edit_widget->move_to_back();
|
||||
|
@ -187,7 +187,7 @@ NonnullRefPtr<Gfx::Font> AbstractView::font_for_index(const ModelIndex& index) c
|
|||
if (!model())
|
||||
return font();
|
||||
|
||||
auto font_data = model()->data(index, ModelRole::Font);
|
||||
auto font_data = index.data(ModelRole::Font);
|
||||
if (font_data.is_font())
|
||||
return font_data.as_font();
|
||||
|
||||
|
@ -280,19 +280,19 @@ void AbstractView::mousemove_event(MouseEvent& event)
|
|||
StringBuilder data_builder;
|
||||
bool first = true;
|
||||
m_selection.for_each_index([&](auto& index) {
|
||||
auto text_data = m_model->data(index);
|
||||
auto text_data = index.data();
|
||||
if (!first)
|
||||
text_builder.append(", ");
|
||||
text_builder.append(text_data.to_string());
|
||||
|
||||
auto drag_data = m_model->data(index, ModelRole::DragData);
|
||||
auto drag_data = index.data(ModelRole::DragData);
|
||||
data_builder.append(drag_data.to_string());
|
||||
data_builder.append('\n');
|
||||
|
||||
first = false;
|
||||
|
||||
if (!bitmap) {
|
||||
Variant icon_data = model()->data(index, ModelRole::Icon);
|
||||
Variant icon_data = index.data(ModelRole::Icon);
|
||||
if (icon_data.is_icon())
|
||||
bitmap = icon_data.as_icon().bitmap_for_size(32);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue