1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:47:44 +00:00

LibGUI: Add FilteringProxyModel

This model does not support nested indices well, in that it flattens
them all out.
That's a FIXME for the future as it does its job for now.
This commit is contained in:
AnotherTest 2020-07-04 22:36:23 +04:30 committed by Andreas Kling
parent c35493c156
commit d04c833002
4 changed files with 198 additions and 2 deletions

View file

@ -67,6 +67,7 @@ public:
Font,
DragData,
TextAlignment,
Search,
Custom = 0x100, // Applications are free to use roles above this number as they please
};
@ -76,12 +77,13 @@ public:
virtual int column_count(const ModelIndex& = ModelIndex()) const = 0;
virtual String column_name(int) const { return {}; }
virtual Variant data(const ModelIndex&, Role = Role::Display) const = 0;
virtual TriState data_matches(const ModelIndex&, Variant) const { return TriState::Unknown; }
virtual void update() = 0;
virtual ModelIndex parent_index(const ModelIndex&) const { return {}; }
virtual ModelIndex index(int row, int column = 0, const ModelIndex& = ModelIndex()) const { return create_index(row, column); }
virtual ModelIndex sibling(int row, int column, const ModelIndex& parent) const;
virtual bool is_editable(const ModelIndex&) const { return false; }
virtual void set_data(const ModelIndex&, const Variant&) {}
virtual void set_data(const ModelIndex&, const Variant&) { }
virtual int tree_column() const { return 0; }
virtual bool accepts_drag(const ModelIndex&, const StringView& data_type);
@ -95,7 +97,7 @@ public:
virtual int key_column() const { return -1; }
virtual SortOrder sort_order() const { return SortOrder::None; }
virtual void set_key_column_and_sort_order(int, SortOrder) {}
virtual void set_key_column_and_sort_order(int, SortOrder) { }
virtual StringView drag_data_type() const { return {}; }