mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 18:10:56 +09:00
LibGUI: Respect Model::Role::BackgroundColor
This implementation is very gappy, but the basic feature allows us to highlight cells with a custom background color.
This commit is contained in:
parent
69583f07e0
commit
3a65e9107e
Notes:
sideshowbarker
2024-07-19 07:42:39 +09:00
Author: https://github.com/awesomekling
Commit: 3a65e9107e
1 changed files with 5 additions and 0 deletions
|
@ -131,6 +131,11 @@ void TableView::paint_event(PaintEvent& event)
|
|||
text_color = is_focused() ? palette().selection_text() : palette().inactive_selection_text();
|
||||
else
|
||||
text_color = model()->data(cell_index, Model::Role::ForegroundColor).to_color(palette().color(foreground_role()));
|
||||
auto cell_background_color = model()->data(cell_index, Model::Role::BackgroundColor);
|
||||
if (cell_background_color.is_valid()) {
|
||||
// FIXME: If all cells on a row provide a color, we should really fill the whole row!
|
||||
painter.fill_rect(cell_rect, cell_background_color.to_color(background_color));
|
||||
}
|
||||
painter.draw_text(cell_rect, data.to_string(), font, column_metadata.text_alignment, text_color, Gfx::TextElision::Right);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue