1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:18:12 +00:00

Browser: Make storage inspector columns sortable

This commit is contained in:
Jelle Raaijmakers 2022-03-30 00:04:47 +02:00 committed by Linus Groh
parent 62fbf282b1
commit 02e2f11380
2 changed files with 6 additions and 1 deletions

View file

@ -26,7 +26,10 @@ StorageWidget::StorageWidget()
m_cookies_table_view = cookies_tab->find_descendant_of_type_named<GUI::TableView>("cookies_tableview");
m_cookies_model = adopt_ref(*new CookiesModel());
m_cookies_table_view->set_model(*m_cookies_model);
m_sorting_model = MUST(GUI::SortingProxyModel::create(*m_cookies_model));
m_sorting_model->set_sort_role(GUI::ModelRole::Display);
m_cookies_table_view->set_model(m_sorting_model);
m_cookies_table_view->set_column_headers_visible(true);
m_cookies_table_view->set_alternating_row_colors(true);
}

View file

@ -8,6 +8,7 @@
#include "CookiesModel.h"
#include "Tab.h"
#include <LibGUI/SortingProxyModel.h>
#include <LibGUI/Widget.h>
#include <LibWeb/Cookie/Cookie.h>
@ -26,6 +27,7 @@ private:
RefPtr<GUI::TableView> m_cookies_table_view;
RefPtr<CookiesModel> m_cookies_model;
RefPtr<GUI::SortingProxyModel> m_sorting_model;
};
}