1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:48:11 +00:00

Spreadsheet: Show errors and make them red

This commit is contained in:
AnotherTest 2020-08-26 07:52:54 +04:30 committed by Andreas Kling
parent cb7fe4fe7c
commit 8db5057dc4
2 changed files with 36 additions and 2 deletions

View file

@ -102,9 +102,10 @@ void SpreadsheetView::TableCellPainter::paint(GUI::Painter& painter, const Gfx::
if (m_table_view.selection().contains(index))
painter.draw_rect(rect.inflated(m_table_view.horizontal_padding() * 2 + 1, 1), palette.ruler_border());
auto text_color = index.data(GUI::ModelRole::ForegroundColor).to_color(palette.color(m_table_view.foreground_role()));
auto data = index.data();
auto text_alignment = index.data(GUI::ModelRole::TextAlignment).to_text_alignment(Gfx::TextAlignment::CenterLeft);
painter.draw_text(rect, data.to_string(), m_table_view.font_for_index(index), text_alignment, palette.color(m_table_view.foreground_role()), Gfx::TextElision::Right);
painter.draw_text(rect, data.to_string(), m_table_view.font_for_index(index), text_alignment, text_color, Gfx::TextElision::Right);
}
}