mirror of
https://github.com/RGBCube/serenity
synced 2025-05-15 07:04:59 +00:00
LibGUI: Add Model::Role::TextAlignment and remove from ColumnMetadata
This commit is contained in:
parent
3c819b8ff4
commit
2e03bded43
19 changed files with 211 additions and 100 deletions
|
@ -103,7 +103,6 @@ void TableView::paint_event(PaintEvent& event)
|
|||
for (int column_index = 0; column_index < model()->column_count(); ++column_index) {
|
||||
if (is_column_hidden(column_index))
|
||||
continue;
|
||||
auto column_metadata = model()->column_metadata(column_index);
|
||||
int column_width = this->column_width(column_index);
|
||||
bool is_key_column = model()->key_column() == column_index;
|
||||
Gfx::Rect cell_rect(horizontal_padding() + x_offset, y, column_width, item_height());
|
||||
|
@ -136,7 +135,8 @@ void TableView::paint_event(PaintEvent& event)
|
|||
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_for_index(cell_index), column_metadata.text_alignment, text_color, Gfx::TextElision::Right);
|
||||
auto text_alignment = model()->data(cell_index, Model::Role::TextAlignment).to_text_alignment(Gfx::TextAlignment::Center);
|
||||
painter.draw_text(cell_rect, data.to_string(), font_for_index(cell_index), text_alignment, text_color, Gfx::TextElision::Right);
|
||||
}
|
||||
}
|
||||
x_offset += column_width + horizontal_padding() * 2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue