1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:38:10 +00:00

LibGUI: Dynamically resize editing content rect in IconView

This makes IconView aware of the text width of the
ModelEditingDelegate widget when editing an index and allows us to
resize the content rect as needed.

This also removes the border from the textbox since it could collide
with the icon in ColumnsView. While editing we also skip painting the
inactive selection rect since it would otherwise show when the content
rect gets smaller.
This commit is contained in:
Marcus Nilsson 2021-09-05 13:32:23 +02:00 committed by Andreas Kling
parent 207319ecf1
commit 0583f75926
6 changed files with 42 additions and 4 deletions

View file

@ -105,7 +105,9 @@ void ColumnsView::paint_event(PaintEvent& event)
}
Gfx::IntRect row_rect { column_x, row * item_height(), column.width, item_height() };
painter.fill_rect(row_rect, background_color);
if (m_edit_index.row() != row)
painter.fill_rect(row_rect, background_color);
auto icon = index.data(ModelRole::Icon);
Gfx::IntRect icon_rect = { column_x + icon_spacing(), 0, icon_size(), icon_size() };