1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 07:48:12 +00:00

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.
This commit is contained in:
Andreas Kling 2019-07-31 21:18:01 +02:00
parent b46dbfe7e4
commit df51014834

View file

@ -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;
}