1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 22:38:12 +00:00

LibGUI: Allow override the font on a per-index basis in GListView

This should be ported to all of the GAbstractView subclasses.
This commit is contained in:
Andreas Kling 2019-10-22 21:38:04 +02:00
parent b89f64cb55
commit 31b5047894
4 changed files with 21 additions and 2 deletions

View file

@ -113,11 +113,12 @@ void GListView::paint_event(GPaintEvent& event)
}
auto column_metadata = model()->column_metadata(m_model_column);
const Font& font = column_metadata.font ? *column_metadata.font : this->font();
Rect row_rect(0, y, content_width(), item_height());
painter.fill_rect(row_rect, background_color);
auto index = model()->index(row_index, m_model_column);
auto data = model()->data(index);
auto font = font_for_index(index);
if (data.is_bitmap()) {
painter.blit(row_rect.location(), data.as_bitmap(), data.as_bitmap().rect());
} else if (data.is_icon()) {