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

LibGUI: Use a separate data role for the table model sorting order.

This allows data to be displayed nicely while sorting happens based on some
underlying raw data. :^)
This commit is contained in:
Andreas Kling 2019-03-09 14:24:34 +01:00
parent 3681a402ba
commit 46caa2663b
11 changed files with 43 additions and 15 deletions

View file

@ -40,6 +40,8 @@ public:
TextAlignment text_alignment { TextAlignment::CenterLeft };
};
enum class Role { Display, Sort, Custom };
virtual ~GTableModel();
virtual int row_count() const = 0;
@ -47,7 +49,7 @@ public:
virtual String row_name(int) const { return { }; }
virtual String column_name(int) const { return { }; }
virtual ColumnMetadata column_metadata(int) const { return { }; }
virtual GVariant data(const GModelIndex&) const = 0;
virtual GVariant data(const GModelIndex&, Role = Role::Display) const = 0;
virtual void update() = 0;
virtual void activate(const GModelIndex&) { }