mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:07:36 +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
|
@ -75,6 +75,8 @@ public:
|
|||
|
||||
virtual GUI::Variant data(const GUI::ModelIndex& index, Role role = Role::Display) const override
|
||||
{
|
||||
if (role == Role::TextAlignment)
|
||||
return Gfx::TextAlignment::CenterLeft;
|
||||
if (role == Role::Font) {
|
||||
if (index.column() == Column::MatchedText)
|
||||
return Gfx::Font::default_fixed_width_font();
|
||||
|
@ -94,14 +96,6 @@ public:
|
|||
return {};
|
||||
}
|
||||
|
||||
virtual ColumnMetadata column_metadata(int column) const override
|
||||
{
|
||||
if (column == Column::MatchedText) {
|
||||
return { 0, Gfx::TextAlignment::CenterLeft };
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
virtual void update() override { }
|
||||
virtual GUI::ModelIndex index(int row, int column = 0, const GUI::ModelIndex& = GUI::ModelIndex()) const override { return create_index(row, column, &m_matches.at(row)); }
|
||||
|
||||
|
|
|
@ -138,13 +138,6 @@ String DisassemblyModel::column_name(int column) const
|
|||
}
|
||||
}
|
||||
|
||||
GUI::Model::ColumnMetadata DisassemblyModel::column_metadata(int column) const
|
||||
{
|
||||
if (column == Column::SampleCount)
|
||||
return ColumnMetadata { 0, Gfx::TextAlignment::CenterRight };
|
||||
return {};
|
||||
}
|
||||
|
||||
struct ColorPair {
|
||||
Color background;
|
||||
Color foreground;
|
||||
|
|
|
@ -61,7 +61,6 @@ public:
|
|||
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override;
|
||||
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; }
|
||||
virtual String column_name(int) const override;
|
||||
virtual ColumnMetadata column_metadata(int) const override;
|
||||
virtual GUI::Variant data(const GUI::ModelIndex&, Role = Role::Display) const override;
|
||||
virtual void update() override;
|
||||
|
||||
|
|
|
@ -108,16 +108,13 @@ String ProfileModel::column_name(int column) const
|
|||
}
|
||||
}
|
||||
|
||||
GUI::Model::ColumnMetadata ProfileModel::column_metadata(int column) const
|
||||
{
|
||||
if (column == Column::SampleCount || column == Column::SelfCount)
|
||||
return ColumnMetadata { 0, Gfx::TextAlignment::CenterRight };
|
||||
return {};
|
||||
}
|
||||
|
||||
GUI::Variant ProfileModel::data(const GUI::ModelIndex& index, Role role) const
|
||||
{
|
||||
auto* node = static_cast<ProfileNode*>(index.internal_data());
|
||||
if (role == Role::TextAlignment) {
|
||||
if (index.column() == Column::SampleCount || index.column() == Column::SelfCount)
|
||||
return Gfx::TextAlignment::CenterRight;
|
||||
}
|
||||
if (role == Role::Icon) {
|
||||
if (index.column() == Column::StackFrame) {
|
||||
if (node->address() >= 0xc0000000)
|
||||
|
|
|
@ -50,7 +50,6 @@ public:
|
|||
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override;
|
||||
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override;
|
||||
virtual String column_name(int) const override;
|
||||
virtual ColumnMetadata column_metadata(int) const override;
|
||||
virtual GUI::Variant data(const GUI::ModelIndex&, Role = Role::Display) const override;
|
||||
virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex& parent = GUI::ModelIndex()) const override;
|
||||
virtual GUI::ModelIndex parent_index(const GUI::ModelIndex&) const override;
|
||||
|
|
|
@ -61,12 +61,15 @@ GUI::Model::ColumnMetadata VBWidgetPropertyModel::column_metadata(int column) co
|
|||
{
|
||||
UNUSED_PARAM(column);
|
||||
if (column == Column::Name)
|
||||
return { 110, Gfx::TextAlignment::CenterLeft };
|
||||
return { 90, Gfx::TextAlignment::CenterLeft };
|
||||
return { 110 };
|
||||
return { 90 };
|
||||
}
|
||||
|
||||
GUI::Variant VBWidgetPropertyModel::data(const GUI::ModelIndex& index, Role role) const
|
||||
{
|
||||
if (role == Role::TextAlignment) {
|
||||
return Gfx::TextAlignment::CenterLeft;
|
||||
}
|
||||
if (role == Role::Font) {
|
||||
if (index.column() == Column::Name)
|
||||
return Gfx::Font::default_bold_font();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue