FluentUI/src/FluTableSortProxyModel.h

31 lines
1.1 KiB
C
Raw Normal View History

2024-03-01 00:19:41 +08:00
#ifndef FLUTABLESORTPROXYMODEL_H
#define FLUTABLESORTPROXYMODEL_H
#include <QSortFilterProxyModel>
#include <QAbstractTableModel>
#include <QtQml/qqml.h>
#include <QJSValue>
#include "stdafx.h"
class FluTableSortProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
Q_PROPERTY_AUTO(QAbstractTableModel*,model)
QML_NAMED_ELEMENT(FluTableSortProxyModel)
public:
explicit FluTableSortProxyModel(QSortFilterProxyModel *parent = nullptr);
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
bool filterAcceptsColumn(int sourceColumn, const QModelIndex &sourceParent) const override;
bool lessThan(const QModelIndex &sourceLeft, const QModelIndex &sourceRight) const override;
Q_INVOKABLE QVariant getRow(int rowIndex);
Q_INVOKABLE void setRow(int rowIndex,QVariant val);
Q_INVOKABLE void removeRow(int rowIndex,int rows);
2024-03-01 23:24:03 +08:00
Q_INVOKABLE void setComparator(QJSValue comparator);
Q_INVOKABLE void setFilter(QJSValue filter);
2024-03-01 00:19:41 +08:00
private:
2024-03-01 23:24:03 +08:00
QJSValue _filter;
2024-03-01 00:19:41 +08:00
QJSValue _comparator;
};
#endif // FLUTABLESORTPROXYMODEL_H