mirror of
https://github.com/status-im/status-desktop.git
synced 2025-03-02 23:41:18 +00:00
feat(StatusQ): custom UndefinedFilter filter for filtering undefined role values
Generic filter for handling undefined values. This kind of filtering cannot be done using ValueFilter. On the other hand using FastExpressionFilter is much more costy in terms of performance overhead. Closes: #13638
This commit is contained in:
parent
ac266bb997
commit
29c15a5bff
@ -111,6 +111,7 @@ add_library(StatusQ SHARED
|
||||
include/StatusQ/stringutilsinternal.h
|
||||
include/StatusQ/submodelproxymodel.h
|
||||
include/StatusQ/sumaggregator.h
|
||||
include/StatusQ/undefinedfilter.h
|
||||
include/StatusQ/writableproxymodel.h
|
||||
src/QClipboardProxy.cpp
|
||||
src/aggregator.cpp
|
||||
@ -132,6 +133,7 @@ add_library(StatusQ SHARED
|
||||
src/stringutilsinternal.cpp
|
||||
src/submodelproxymodel.cpp
|
||||
src/sumaggregator.cpp
|
||||
src/undefinedfilter.cpp
|
||||
src/writableproxymodel.cpp
|
||||
|
||||
# wallet
|
||||
|
16
ui/StatusQ/include/StatusQ/undefinedfilter.h
Normal file
16
ui/StatusQ/include/StatusQ/undefinedfilter.h
Normal file
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <filters/rolefilter.h>
|
||||
|
||||
class UndefinedFilter : public qqsfpm::RoleFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
using RoleFilter::RoleFilter;
|
||||
|
||||
protected:
|
||||
bool filterRow(
|
||||
const QModelIndex &sourceIndex,
|
||||
const qqsfpm::QQmlSortFilterProxyModel& proxyModel) const override;
|
||||
};
|
@ -8,6 +8,7 @@
|
||||
#include "StatusQ/fastexpressionfilter.h"
|
||||
#include "StatusQ/fastexpressionrole.h"
|
||||
#include "StatusQ/fastexpressionsorter.h"
|
||||
#include "StatusQ/formatteddoubleproperty.h"
|
||||
#include "StatusQ/leftjoinmodel.h"
|
||||
#include "StatusQ/modelutilsinternal.h"
|
||||
#include "StatusQ/movablemodel.h"
|
||||
@ -19,8 +20,8 @@
|
||||
#include "StatusQ/stringutilsinternal.h"
|
||||
#include "StatusQ/submodelproxymodel.h"
|
||||
#include "StatusQ/sumaggregator.h"
|
||||
#include "StatusQ/undefinedfilter.h"
|
||||
#include "StatusQ/writableproxymodel.h"
|
||||
#include "StatusQ/formatteddoubleproperty.h"
|
||||
|
||||
#include "wallet/managetokenscontroller.h"
|
||||
#include "wallet/managetokensmodel.h"
|
||||
@ -48,6 +49,7 @@ public:
|
||||
qmlRegisterType<FastExpressionFilter>("StatusQ", 0, 1, "FastExpressionFilter");
|
||||
qmlRegisterType<FastExpressionRole>("StatusQ", 0, 1, "FastExpressionRole");
|
||||
qmlRegisterType<FastExpressionSorter>("StatusQ", 0, 1, "FastExpressionSorter");
|
||||
qmlRegisterType<UndefinedFilter>("StatusQ", 0, 1, "UndefinedFilter");
|
||||
|
||||
qmlRegisterType<LeftJoinModel>("StatusQ", 0, 1, "LeftJoinModel");
|
||||
qmlRegisterType<SubmodelProxyModel>("StatusQ", 0, 1, "SubmodelProxyModel");
|
||||
|
11
ui/StatusQ/src/undefinedfilter.cpp
Normal file
11
ui/StatusQ/src/undefinedfilter.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include "StatusQ/undefinedfilter.h"
|
||||
|
||||
#include <qqmlsortfilterproxymodel.h>
|
||||
|
||||
using namespace qqsfpm;
|
||||
|
||||
bool UndefinedFilter::filterRow(const QModelIndex& sourceIndex,
|
||||
const QQmlSortFilterProxyModel& proxyModel) const
|
||||
{
|
||||
return !sourceData(sourceIndex, proxyModel).isValid();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user