1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 14:55:08 +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

@ -155,17 +155,17 @@ int ManualModel::column_count(const GUI::ModelIndex&) const
return 1;
}
GUI::Variant ManualModel::data(const GUI::ModelIndex& index, Role role) const
GUI::Variant ManualModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const
{
auto* node = static_cast<const ManualNode*>(index.internal_data());
switch (role) {
case Role::Search:
case GUI::ModelRole::Search:
if (!node->is_page())
return {};
return String(page_view(page_path(index)).value());
case Role::Display:
case GUI::ModelRole::Display:
return node->name();
case Role::Icon:
case GUI::ModelRole::Icon:
if (node->is_page())
return m_page_icon;
if (node->is_open())