mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 17:17:35 +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:
parent
f6d7204689
commit
a1e381a0f8
66 changed files with 201 additions and 167 deletions
|
@ -38,9 +38,9 @@ public:
|
|||
virtual int row_count(const GUI::ModelIndex&) const override { return 2; }
|
||||
virtual int column_count(const GUI::ModelIndex&) const override { return 1; }
|
||||
virtual void update() override {}
|
||||
virtual GUI::Variant data(const GUI::ModelIndex& index, Role role) const override
|
||||
virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role) const override
|
||||
{
|
||||
if (role != Role::Display)
|
||||
if (role != GUI::ModelRole::Display)
|
||||
return {};
|
||||
switch (index.row()) {
|
||||
case 0:
|
||||
|
@ -94,7 +94,7 @@ VBPropertiesWindow::VBPropertiesWindow()
|
|||
if (!m_table_view->model())
|
||||
return nullptr;
|
||||
auto type_index = m_table_view->model()->index(index.row(), VBWidgetPropertyModel::Column::Type);
|
||||
auto type = m_table_view->model()->data(type_index, GUI::Model::Role::Custom).to_i32();
|
||||
auto type = m_table_view->model()->data(type_index, GUI::ModelRole::Custom).to_i32();
|
||||
switch ((GUI::Variant::Type)type) {
|
||||
case GUI::Variant::Type::Bool:
|
||||
return make<BoolModelEditingDelegate>();
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
virtual int row_count(const GUI::ModelIndex&) const override;
|
||||
virtual int column_count(const GUI::ModelIndex&) const override { return Column::__Count; }
|
||||
virtual String column_name(int column) const override;
|
||||
virtual GUI::Variant data(const GUI::ModelIndex&, Role = Role::Display) const override;
|
||||
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
|
||||
virtual void update() override { did_update(); }
|
||||
virtual bool is_editable(const GUI::ModelIndex&) const override;
|
||||
virtual void set_data(const GUI::ModelIndex&, const GUI::Variant&) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue