mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 20:15:00 +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
|
@ -94,7 +94,7 @@ bool JsonArrayModel::remove(int row)
|
|||
Model::ColumnMetadata JsonArrayModel::column_metadata(int column) const
|
||||
{
|
||||
ASSERT(column < static_cast<int>(m_fields.size()));
|
||||
return { 100, m_fields[column].text_alignment };
|
||||
return { 100 };
|
||||
}
|
||||
|
||||
Variant JsonArrayModel::data(const ModelIndex& index, Role role) const
|
||||
|
@ -102,6 +102,10 @@ Variant JsonArrayModel::data(const ModelIndex& index, Role role) const
|
|||
auto& field_spec = m_fields[index.column()];
|
||||
auto& object = m_array.at(index.row()).as_object();
|
||||
|
||||
if (role == Model::Role::TextAlignment) {
|
||||
return field_spec.text_alignment;
|
||||
}
|
||||
|
||||
if (role == Model::Role::Display) {
|
||||
auto& json_field_name = field_spec.json_field_name;
|
||||
auto data = object.get(json_field_name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue