Archived
1
Fork 0
This repository has been archived on 2025-04-12. You can view files and clone it, but cannot push or open issues or pull requests.
trinity/include/roomlistsortmodel.h
2022-08-15 21:53:56 -04:00

35 lines
985 B
C++
Executable file

#pragma once
#include <QSortFilterProxyModel>
class RoomListSortModel : public QSortFilterProxyModel {
Q_OBJECT
public:
bool lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const;
Q_INVOKABLE unsigned int getOriginalIndex(const unsigned int i) const {
auto const proxyIndex = index(i, 0);
auto const sourceIndex = mapToSource(proxyIndex);
if (!sourceIndex.isValid())
return 0;
else
return sourceIndex.row();
}
};
class MemberListSortModel : public QSortFilterProxyModel {
Q_OBJECT
public:
bool lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const;
Q_INVOKABLE unsigned int getOriginalIndex(const unsigned int i) const {
auto const proxyIndex = index(i, 0);
auto const sourceIndex = mapToSource(proxyIndex);
if (!sourceIndex.isValid())
return 0;
else
return sourceIndex.row();
}
};