From 2e03bded43344d4dd2d4f19d4d963646aaa77e40 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 21 May 2020 19:36:09 +0200 Subject: LibGUI: Add Model::Role::TextAlignment and remove from ColumnMetadata --- Libraries/LibGUI/ListView.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'Libraries/LibGUI/ListView.cpp') diff --git a/Libraries/LibGUI/ListView.cpp b/Libraries/LibGUI/ListView.cpp index 68592a0f79..b16b012134 100644 --- a/Libraries/LibGUI/ListView.cpp +++ b/Libraries/LibGUI/ListView.cpp @@ -143,8 +143,6 @@ void ListView::paint_event(PaintEvent& event) } } - auto column_metadata = model()->column_metadata(m_model_column); - Gfx::Rect row_rect(0, y, content_width(), item_height()); painter.fill_rect(row_rect, background_color); auto index = model()->index(row_index, m_model_column); @@ -164,7 +162,8 @@ void ListView::paint_event(PaintEvent& event) auto text_rect = row_rect; text_rect.move_by(horizontal_padding(), 0); text_rect.set_width(text_rect.width() - horizontal_padding() * 2); - painter.draw_text(text_rect, data.to_string(), font, column_metadata.text_alignment, text_color); + auto text_alignment = model()->data(index, Model::Role::TextAlignment).to_text_alignment(Gfx::TextAlignment::Center); + painter.draw_text(text_rect, data.to_string(), font, text_alignment, text_color); } ++painted_item_index; -- cgit v1.2.3