1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-15 16:32:06 +00:00

LibGUI: Move GUI::Model::Role to GUI::ModelRole

This is preparation for using ModelRole in the ModelIndex API.
This commit is contained in:
Andreas Kling 2020-08-16 16:00:07 +02:00
parent f6d7204689
commit a1e381a0f8
66 changed files with 201 additions and 167 deletions

View file

@ -57,23 +57,23 @@ String VBWidgetPropertyModel::column_name(int column) const
}
}
GUI::Variant VBWidgetPropertyModel::data(const GUI::ModelIndex& index, Role role) const
GUI::Variant VBWidgetPropertyModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const
{
if (role == Role::TextAlignment) {
if (role == GUI::ModelRole::TextAlignment) {
return Gfx::TextAlignment::CenterLeft;
}
if (role == Role::Font) {
if (role == GUI::ModelRole::Font) {
if (index.column() == Column::Name)
return Gfx::Font::default_bold_font();
return {};
}
if (role == Role::Custom) {
if (role == GUI::ModelRole::Custom) {
auto& property = m_widget.m_properties[index.row()];
if (index.column() == Column::Type)
return (int)property.value().type();
return {};
}
if (role == Role::Display) {
if (role == GUI::ModelRole::Display) {
auto& property = m_widget.m_properties[index.row()];
switch (index.column()) {
case Column::Name:
@ -85,7 +85,7 @@ GUI::Variant VBWidgetPropertyModel::data(const GUI::ModelIndex& index, Role role
}
ASSERT_NOT_REACHED();
}
if (role == Role::ForegroundColor) {
if (role == GUI::ModelRole::ForegroundColor) {
auto& property = m_widget.m_properties[index.row()];
switch (index.column()) {
case Column::Name: