parent
eaff2aa0b9
commit
c5d9e46917
|
@ -9,9 +9,18 @@ QQmlSortFilterProxyModel::QQmlSortFilterProxyModel(QObject *parent) :
|
|||
{
|
||||
connect(this, &QAbstractProxyModel::sourceModelChanged, this, &QQmlSortFilterProxyModel::updateRoles);
|
||||
connect(this, &QAbstractItemModel::modelReset, this, &QQmlSortFilterProxyModel::updateRoles);
|
||||
connect(this, &QAbstractItemModel::rowsInserted, this, &QQmlSortFilterProxyModel::countChanged);
|
||||
connect(this, &QAbstractItemModel::rowsRemoved, this, &QQmlSortFilterProxyModel::countChanged);
|
||||
connect(this, &QAbstractItemModel::modelReset, this, &QQmlSortFilterProxyModel::countChanged);
|
||||
connect(this, &QAbstractItemModel::layoutChanged, this, &QQmlSortFilterProxyModel::countChanged);
|
||||
setDynamicSortFilter(true);
|
||||
}
|
||||
|
||||
int QQmlSortFilterProxyModel::count() const
|
||||
{
|
||||
return rowCount();
|
||||
}
|
||||
|
||||
QString QQmlSortFilterProxyModel::filterRoleName() const
|
||||
{
|
||||
return m_filterRoleName;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
class QQmlSortFilterProxyModel : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int count READ count NOTIFY countChanged)
|
||||
Q_PROPERTY(QString filterRoleName READ filterRoleName WRITE setFilterRoleName NOTIFY filterRoleNameChanged)
|
||||
Q_PROPERTY(QString filterPattern READ filterPattern WRITE setFilterPattern NOTIFY filterPatternChanged)
|
||||
Q_PROPERTY(PatternSyntax filterPatternSyntax READ filterPatternSyntax WRITE setFilterPatternSyntax NOTIFY filterPatternSyntaxChanged)
|
||||
|
@ -29,6 +30,8 @@ public:
|
|||
|
||||
QQmlSortFilterProxyModel(QObject* parent = 0);
|
||||
|
||||
int count() const;
|
||||
|
||||
QString filterRoleName() const;
|
||||
void setFilterRoleName(QString filterRoleName);
|
||||
|
||||
|
@ -53,6 +56,8 @@ public:
|
|||
void setSortExpression(QQmlScriptString compareScriptString);
|
||||
|
||||
signals:
|
||||
void countChanged();
|
||||
|
||||
void filterRoleNameChanged();
|
||||
void filterPatternSyntaxChanged();
|
||||
void filterPatternChanged();
|
||||
|
|
Loading…
Reference in New Issue