[Interest] Can QSortFilterProxyModel sort the filtered data only?

Jan Kundrát jkt at flaska.net
Fri Apr 11 17:00:31 CEST 2014


On Friday, 11 April 2014 00:34:10 CEST, Mark Gaiser wrote:
> The use case for this is quite simple. File browsing. The actual use
> case within that is:
> - Grouping files based on some (user defined) type (like mime)
> - Within _each_ ("each".. that's the difficult part) group sorting on
> some other type (like date, size, etc...)

What about tweaking your sort function instead?

bool lessThan(a, b)
{
    if (a.mime >= b.mime) {
        return false;
    } else if (a.date >= b.date) {
        return false;
    } else if (a.size >= b.size) {
        return false;
    } else {
        return true;
    }
}

Cheers,
Jan

-- 
Trojitá, a fast Qt IMAP e-mail client -- http://trojita.flaska.net/



More information about the Interest mailing list