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_p.h
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#ifndef QQMLFILTERBASE_H
6#define QQMLFILTERBASE_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtCore/QObject>
20#include <QtCore/QAbstractItemModel>
21#include <QtQml/private/qqmlcustomparser_p.h>
22#include <QtQmlModels/private/qtqmlmodelsglobal_p.h>
23
24QT_BEGIN_NAMESPACE
25
26class QQmlSortFilterProxyModel;
28
29class Q_QMLMODELS_EXPORT QQmlFilterBase: public QObject
30{
31 Q_OBJECT
32 Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged FINAL)
33 Q_PROPERTY(bool inverted READ isInverted WRITE setInverted NOTIFY invertedChanged FINAL)
34 Q_PROPERTY(int column READ column WRITE setColumn NOTIFY columnChanged FINAL)
35 QML_NAMED_ELEMENT(FilterBase)
36 QML_UNCREATABLE("")
37 QML_ADDED_IN_VERSION(6, 10)
38
39public:
40 bool enabled() const;
41 void setEnabled(bool bEnable);
42
43 bool isInverted() const;
44 void setInverted(bool bInvert);
45
46 virtual int column() const;
47 virtual void setColumn(int column);
48
49 virtual bool filterAcceptsRowInternal(int, const QModelIndex&, const QQmlSortFilterProxyModel *) const { return true; }
50 virtual bool filterAcceptsColumnInternal(int, const QModelIndex&, const QQmlSortFilterProxyModel *) const { return true; }
51 virtual void update(const QQmlSortFilterProxyModel *) { /* do nothing */ };
52 virtual bool supportColumnFiltering() const { return false; }
53 virtual bool isActive() const { return enabled(); }
54
55Q_SIGNALS:
56 void invalidateModel();
57 void invalidateCache(QQmlFilterBase *filter);
58 void enabledChanged();
59 void invertedChanged();
60 void columnChanged();
61
62protected:
63 explicit QQmlFilterBase(QQmlFilterBasePrivate *privObj, QObject *parent);
64
65public slots:
66 void invalidate(bool updateCache = false);
67
68private:
69 Q_DECLARE_PRIVATE(QQmlFilterBase)
70};
71
73{
74 Q_DECLARE_PUBLIC(QQmlFilterBase)
75
76private:
77 bool m_enabled = true;
78 bool m_inverted = false;
79 int m_filterColumn = -1;
80};
81
82QT_END_NAMESPACE
83
84#endif // QQMLFILTERBASE_H