mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-05 09:35:28 +08:00
fix bug #439
This commit is contained in:
28
src/FluTableSortProxyModel.h
Normal file
28
src/FluTableSortProxyModel.h
Normal file
@ -0,0 +1,28 @@
|
||||
#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 void setSortComparator(QJSValue comparator);
|
||||
Q_INVOKABLE QVariant getRow(int rowIndex);
|
||||
Q_INVOKABLE void setRow(int rowIndex,QVariant val);
|
||||
Q_INVOKABLE void removeRow(int rowIndex,int rows);
|
||||
private:
|
||||
QJSValue _comparator;
|
||||
};
|
||||
|
||||
#endif // FLUTABLESORTPROXYMODEL_H
|
Reference in New Issue
Block a user