LibGUI: Add Model::Role::TextAlignment and remove from ColumnMetadata

This commit is contained in:
Andreas Kling 2020-05-21 19:36:09 +02:00
parent 3c819b8ff4
commit 2e03bded43
Notes: sideshowbarker 2024-07-19 06:16:42 +09:00
19 changed files with 211 additions and 100 deletions

View file

@ -273,7 +273,6 @@ void TreeView::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);
painter.draw_rect(toggle_rect, text_color);
@ -295,7 +294,8 @@ void TreeView::paint_event(PaintEvent& event)
} else {
if (!is_selected_row)
text_color = model.data(cell_index, Model::Role::ForegroundColor).to_color(palette().color(foreground_role()));
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);
}
}
} else {