From df5101483400e9baae0eea8537fdec5936977c93 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 31 Jul 2019 21:18:01 +0200 Subject: [PATCH] GTableView: Elide cell content so it doesn't overflow the cell rect I originally thought I'd have to implement text clipping in Painter for this, but it seems like I can get away without doing that today. :^) Fixes #390. --- Libraries/LibGUI/GTableView.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/LibGUI/GTableView.cpp b/Libraries/LibGUI/GTableView.cpp index 5fe0ac8ea9..4bc27049c8 100644 --- a/Libraries/LibGUI/GTableView.cpp +++ b/Libraries/LibGUI/GTableView.cpp @@ -263,7 +263,7 @@ void GTableView::paint_event(GPaintEvent& event) text_color = Color::White; else text_color = model()->data(cell_index, GModel::Role::ForegroundColor).to_color(Color::Black); - painter.draw_text(cell_rect, data.to_string(), font, column_metadata.text_alignment, text_color); + painter.draw_text(cell_rect, data.to_string(), font, column_metadata.text_alignment, text_color, TextElision::Right); } x_offset += column_width + horizontal_padding() * 2; }