From 235ae80e5e9848f332c12f0dafd40fb05bed2db8 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 12 Apr 2020 15:13:39 +0200 Subject: [PATCH] LibGUI: Make TableView ignore custom colors for selected rows This allows them to look selected instead. --- Libraries/LibGUI/TableView.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Libraries/LibGUI/TableView.cpp b/Libraries/LibGUI/TableView.cpp index 7d518b4e045..64fb781fedc 100644 --- a/Libraries/LibGUI/TableView.cpp +++ b/Libraries/LibGUI/TableView.cpp @@ -130,10 +130,10 @@ 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_for_fill, cell_background_color.to_color(background_color)); + if (!is_selected_row) { + auto cell_background_color = model()->data(cell_index, Model::Role::BackgroundColor); + if (cell_background_color.is_valid()) + painter.fill_rect(cell_rect_for_fill, 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); }