diff --git a/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp b/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp index 9e8505f5dc3..da3868dda25 100644 --- a/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp +++ b/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp @@ -27,6 +27,7 @@ #include "ProcessFileDescriptorMapWidget.h" #include #include +#include #include ProcessFileDescriptorMapWidget::ProcessFileDescriptorMapWidget() @@ -56,7 +57,8 @@ ProcessFileDescriptorMapWidget::ProcessFileDescriptorMapWidget() return object.get("can_write").to_bool() ? "Yes" : "No"; }); - m_table_view->set_model(GUI::JsonArrayModel::create({}, move(pid_fds_fields))); + m_model = GUI::JsonArrayModel::create({}, move(pid_fds_fields)); + m_table_view->set_model(GUI::SortingProxyModel::create(*m_model)); } ProcessFileDescriptorMapWidget::~ProcessFileDescriptorMapWidget() @@ -68,5 +70,5 @@ void ProcessFileDescriptorMapWidget::set_pid(pid_t pid) if (m_pid == pid) return; m_pid = pid; - static_cast(m_table_view->model())->set_json_path(String::format("/proc/%d/fds", m_pid)); + m_model->set_json_path(String::format("/proc/%d/fds", m_pid)); } diff --git a/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.h b/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.h index a03bf7d1cff..97e68b6bd15 100644 --- a/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.h +++ b/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.h @@ -39,5 +39,6 @@ private: ProcessFileDescriptorMapWidget(); RefPtr m_table_view; + RefPtr m_model; pid_t m_pid { -1 }; }; diff --git a/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp b/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp index 4121057fef6..98fd77e72de 100644 --- a/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp +++ b/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp @@ -27,6 +27,7 @@ #include "ProcessUnveiledPathsWidget.h" #include #include +#include #include ProcessUnveiledPathsWidget::ProcessUnveiledPathsWidget() @@ -38,7 +39,9 @@ ProcessUnveiledPathsWidget::ProcessUnveiledPathsWidget() Vector pid_unveil_fields; pid_unveil_fields.empend("path", "Path", Gfx::TextAlignment::CenterLeft); pid_unveil_fields.empend("permissions", "Permissions", Gfx::TextAlignment::CenterLeft); - m_table_view->set_model(GUI::JsonArrayModel::create({}, move(pid_unveil_fields))); + + m_model = GUI::JsonArrayModel::create({}, move(pid_unveil_fields)); + m_table_view->set_model(GUI::SortingProxyModel::create(*m_model)); } ProcessUnveiledPathsWidget::~ProcessUnveiledPathsWidget() @@ -50,5 +53,5 @@ void ProcessUnveiledPathsWidget::set_pid(pid_t pid) if (m_pid == pid) return; m_pid = pid; - static_cast(m_table_view->model())->set_json_path(String::format("/proc/%d/unveil", m_pid)); + m_model->set_json_path(String::format("/proc/%d/unveil", m_pid)); } diff --git a/Applications/SystemMonitor/ProcessUnveiledPathsWidget.h b/Applications/SystemMonitor/ProcessUnveiledPathsWidget.h index 99eb84055a9..d930c90bf7b 100644 --- a/Applications/SystemMonitor/ProcessUnveiledPathsWidget.h +++ b/Applications/SystemMonitor/ProcessUnveiledPathsWidget.h @@ -39,5 +39,6 @@ private: ProcessUnveiledPathsWidget(); RefPtr m_table_view; + RefPtr m_model; pid_t m_pid { -1 }; };