ソースを参照

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.
Andreas Kling 6 年 前
コミット
df51014834
1 ファイル変更1 行追加1 行削除
  1. 1 1
      Libraries/LibGUI/GTableView.cpp

+ 1 - 1
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;
         }