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
Notes: sideshowbarker 2024-07-19 03:33:11 +09:00
66 changed files with 201 additions and 167 deletions

View file

@ -85,13 +85,13 @@ int WidgetTreeModel::column_count(const GUI::ModelIndex&) const
return 1;
}
GUI::Variant WidgetTreeModel::data(const GUI::ModelIndex& index, Role role) const
GUI::Variant WidgetTreeModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const
{
auto* widget = static_cast<GUI::Widget*>(index.internal_data());
if (role == Role::Icon) {
if (role == GUI::ModelRole::Icon) {
return m_widget_icon;
}
if (role == Role::Display) {
if (role == GUI::ModelRole::Display) {
return String::format("%s (%s)", widget->class_name(), widget->relative_rect().to_string().characters());
}
return {};