1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 16:37:47 +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

@ -135,8 +135,9 @@ String DirectoryTableModel::name_for_gid(uid_t gid) const
return (*it).value;
}
GVariant DirectoryTableModel::data(const GModelIndex& index) const
GVariant DirectoryTableModel::data(const GModelIndex& index, Role role) const
{
ASSERT(role == Role::Display);
auto& entry = this->entry(index.row());
switch (index.column()) {
case Column::Icon: return icon_for(entry);

View file

@ -24,7 +24,7 @@ public:
virtual int column_count() const override;
virtual String column_name(int column) const override;
virtual ColumnMetadata column_metadata(int column) const override;
virtual GVariant data(const GModelIndex&) const override;
virtual GVariant data(const GModelIndex&, Role = Role::Display) const override;
virtual void update() override;
virtual void activate(const GModelIndex&) override;