Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmlfilterbase.cpp
Go to the documentation of this file.
1
// Copyright (C) 2025 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
include
<
QtQmlModels
/
private
/
qqmlsortfilterproxymodel_p
.
h
>
6
#
include
<
QtQmlModels
/
private
/
qqmlfilterbase_p
.
h
>
7
8
QT_BEGIN_NAMESPACE
9
10
/*!
11
\qmltype Filter
12
\inherits QtObject
13
\inqmlmodule QtQml.Models
14
\since 6.10
15
\preliminary
16
\brief Abstract base type providing functionality common to filters.
17
18
Filter provides a set of common properties for all the filters that they
19
inherit from.
20
*/
21
22
QQmlFilterBase::QQmlFilterBase(QQmlFilterBasePrivate *privObj, QObject *parent)
23
: QObject (*privObj, parent)
24
{
25
}
26
27
/*!
28
\qmlproperty bool Filter::enabled
29
30
This property enables the \l SortFilterProxyModel to consider this filter
31
while filtering the model data.
32
33
The default value is \c true.
34
*/
35
bool
QQmlFilterBase::enabled()
const
36
{
37
Q_D(
const
QQmlFilterBase);
38
return
d->m_enabled;
39
}
40
41
void
QQmlFilterBase::setEnabled(
const
bool
enabled)
42
{
43
Q_D(QQmlFilterBase);
44
if
(d->m_enabled == enabled)
45
return
;
46
d->m_enabled = enabled;
47
invalidate(
true
);
48
emit enabledChanged();
49
}
50
51
/*!
52
\qmlproperty bool Filter::inverted
53
54
This property inverts the filter, causing the data that would normally be
55
filtered out to be presented instead.
56
57
The default value is \c false.
58
*/
59
bool
QQmlFilterBase::isInverted()
const
60
{
61
Q_D(
const
QQmlFilterBase);
62
return
d->m_inverted;
63
}
64
65
void
QQmlFilterBase::setInverted(
const
bool
invert)
66
{
67
Q_D(QQmlFilterBase);
68
if
(d->m_inverted == invert)
69
return
;
70
d->m_inverted = invert;
71
invalidate();
72
emit invertedChanged();
73
}
74
75
/*!
76
\qmlproperty int Filter::column
77
78
This property specifies which column in the model the filter should be
79
applied on. If the value is \c -1, the filter will be applied to all
80
the columns in the model.
81
82
The default value is \c -1.
83
*/
84
int
QQmlFilterBase::column()
const
85
{
86
Q_D(
const
QQmlFilterBase);
87
return
d->m_filterColumn;
88
}
89
90
void
QQmlFilterBase::setColumn(
const
int
column)
91
{
92
Q_D(QQmlFilterBase);
93
if
(d->m_filterColumn == column)
94
return
;
95
d->m_filterColumn = column;
96
invalidate();
97
emit columnChanged();
98
}
99
100
/*!
101
\internal
102
*/
103
void
QQmlFilterBase::invalidate(
bool
updateCache)
104
{
105
// Update the cached filters and invalidate the model
106
if
(updateCache)
107
emit invalidateCache(
this
);
108
emit invalidateModel();
109
}
110
111
QT_END_NAMESPACE
112
113
#
include
"moc_qqmlfilterbase_p.cpp"
qtdeclarative
src
qmlmodels
sfpm
filters
qqmlfilterbase.cpp
Generated on
for Qt by
1.16.1