diff options
author | Andreas Kling <kling@serenityos.org> | 2020-09-24 11:29:21 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-09-24 11:29:21 +0200 |
commit | 7f8e18b86afe2fb7d7fc1e474b3005929eef6678 (patch) | |
tree | 908b320a9fd1b0ece81b111aa6802f368cf3d648 /Libraries/LibGUI | |
parent | b99eaad6935c1c3082e9298bc02967750fe06459 (diff) | |
download | serenity-7f8e18b86afe2fb7d7fc1e474b3005929eef6678.zip |
LibGUI: Make SortingProxyModel forward is_editable() and set_data()
This will allow us to edit models through a SortingProxyModel. :^)
Diffstat (limited to 'Libraries/LibGUI')
-rw-r--r-- | Libraries/LibGUI/SortingProxyModel.cpp | 10 | ||||
-rw-r--r-- | Libraries/LibGUI/SortingProxyModel.h | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/Libraries/LibGUI/SortingProxyModel.cpp b/Libraries/LibGUI/SortingProxyModel.cpp index 07ca22806a..596938a2d8 100644 --- a/Libraries/LibGUI/SortingProxyModel.cpp +++ b/Libraries/LibGUI/SortingProxyModel.cpp @@ -285,4 +285,14 @@ bool SortingProxyModel::is_column_sortable(int column_index) const return source().is_column_sortable(column_index); } +bool SortingProxyModel::is_editable(const ModelIndex& proxy_index) const +{ + return source().is_editable(map_to_source(proxy_index)); +} + +void SortingProxyModel::set_data(const ModelIndex& proxy_index, const Variant& data) +{ + source().set_data(map_to_source(proxy_index), data); +} + } diff --git a/Libraries/LibGUI/SortingProxyModel.h b/Libraries/LibGUI/SortingProxyModel.h index 439b2b43e9..3b192df6e6 100644 --- a/Libraries/LibGUI/SortingProxyModel.h +++ b/Libraries/LibGUI/SortingProxyModel.h @@ -45,6 +45,8 @@ public: virtual StringView drag_data_type() const override; virtual ModelIndex parent_index(const ModelIndex&) const override; virtual ModelIndex index(int row, int column, const ModelIndex& parent) const override; + virtual bool is_editable(const ModelIndex&) const override; + virtual void set_data(const ModelIndex&, const Variant&) override; virtual bool is_column_sortable(int column_index) const override; |