mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:48:12 +00:00
Make it possible to sort a GTableModel by column+order.
This is accomplished by putting a GSortingProxyTableModel between the model and the view. It's pretty simplistic but it works for this use case. :^)
This commit is contained in:
parent
0680fe2383
commit
7d1142c7d9
16 changed files with 278 additions and 40 deletions
|
@ -10,6 +10,8 @@
|
|||
|
||||
class GTableView;
|
||||
|
||||
enum class GSortOrder { None, Ascending, Descending };
|
||||
|
||||
class GModelNotification {
|
||||
public:
|
||||
enum Type {
|
||||
|
@ -57,9 +59,15 @@ public:
|
|||
void set_selected_index(const GModelIndex& index) { m_selected_index = index; }
|
||||
GModelIndex selected_index() const { return m_selected_index; }
|
||||
|
||||
virtual int key_column() const { return -1; }
|
||||
virtual GSortOrder sort_order() const { return GSortOrder::None; }
|
||||
virtual void set_key_column_and_sort_order(int, GSortOrder) { }
|
||||
|
||||
void register_view(Badge<GTableView>, GTableView&);
|
||||
void unregister_view(Badge<GTableView>, GTableView&);
|
||||
|
||||
Function<void(GTableModel&)> on_model_update;
|
||||
|
||||
protected:
|
||||
GTableModel();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue