diff options
author | Andreas Kling <kling@serenityos.org> | 2020-05-21 19:36:09 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-21 19:55:44 +0200 |
commit | 2e03bded43344d4dd2d4f19d4d963646aaa77e40 (patch) | |
tree | 28f044c3485c240307abb8c289cbdb28831dfb80 /DevTools/ProfileViewer | |
parent | 3c819b8ff4d8c1cefceeb65ee0e89e3858a11bb5 (diff) | |
download | serenity-2e03bded43344d4dd2d4f19d4d963646aaa77e40.zip |
LibGUI: Add Model::Role::TextAlignment and remove from ColumnMetadata
Diffstat (limited to 'DevTools/ProfileViewer')
-rw-r--r-- | DevTools/ProfileViewer/DisassemblyModel.cpp | 7 | ||||
-rw-r--r-- | DevTools/ProfileViewer/DisassemblyModel.h | 1 | ||||
-rw-r--r-- | DevTools/ProfileViewer/ProfileModel.cpp | 11 | ||||
-rw-r--r-- | DevTools/ProfileViewer/ProfileModel.h | 1 |
4 files changed, 4 insertions, 16 deletions
diff --git a/DevTools/ProfileViewer/DisassemblyModel.cpp b/DevTools/ProfileViewer/DisassemblyModel.cpp index 4807a1207a..3386ba946d 100644 --- a/DevTools/ProfileViewer/DisassemblyModel.cpp +++ b/DevTools/ProfileViewer/DisassemblyModel.cpp @@ -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; diff --git a/DevTools/ProfileViewer/DisassemblyModel.h b/DevTools/ProfileViewer/DisassemblyModel.h index de45415f8d..499a980997 100644 --- a/DevTools/ProfileViewer/DisassemblyModel.h +++ b/DevTools/ProfileViewer/DisassemblyModel.h @@ -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; diff --git a/DevTools/ProfileViewer/ProfileModel.cpp b/DevTools/ProfileViewer/ProfileModel.cpp index fa77ac2a73..1d628e66c0 100644 --- a/DevTools/ProfileViewer/ProfileModel.cpp +++ b/DevTools/ProfileViewer/ProfileModel.cpp @@ -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) diff --git a/DevTools/ProfileViewer/ProfileModel.h b/DevTools/ProfileViewer/ProfileModel.h index 9e816ec2ea..a25520ec3c 100644 --- a/DevTools/ProfileViewer/ProfileModel.h +++ b/DevTools/ProfileViewer/ProfileModel.h @@ -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; |