1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:58:13 +00:00

LibGUI: Implement searching/jumping as you type in views

This allows the user to start typing and highlighting and jumping
to a match in ColumnsView, IconView, TableView and TreeView if
the model supports it.
This commit is contained in:
Tom 2020-10-20 15:13:28 -06:00 committed by Andreas Kling
parent 307f0bc778
commit 52a847a0eb
13 changed files with 244 additions and 19 deletions

View file

@ -141,8 +141,7 @@ void ColumnsView::paint_event(PaintEvent& event)
icon_rect.right() + 1 + icon_spacing(), row * item_height(),
column.width - icon_spacing() - icon_size() - icon_spacing() - icon_spacing() - s_arrow_bitmap_width - icon_spacing(), item_height()
};
auto text = index.data().to_string();
painter.draw_text(text_rect, text, Gfx::TextAlignment::CenterLeft, text_color);
draw_item_text(painter, index, is_selected_row, text_rect, index.data().to_string(), font_for_index(index), Gfx::TextAlignment::CenterLeft, Gfx::TextElision::None);
bool expandable = model()->row_count(index) > 0;
if (expandable) {