diff options
author | Andreas Kling <kling@serenityos.org> | 2020-05-21 19:36:09 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-21 19:55:44 +0200 |
commit | 2e03bded43344d4dd2d4f19d4d963646aaa77e40 (patch) | |
tree | 28f044c3485c240307abb8c289cbdb28831dfb80 /Libraries/LibGUI/ListView.cpp | |
parent | 3c819b8ff4d8c1cefceeb65ee0e89e3858a11bb5 (diff) | |
download | serenity-2e03bded43344d4dd2d4f19d4d963646aaa77e40.zip |
LibGUI: Add Model::Role::TextAlignment and remove from ColumnMetadata
Diffstat (limited to 'Libraries/LibGUI/ListView.cpp')
-rw-r--r-- | Libraries/LibGUI/ListView.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
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; |