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 explicit QQmlFilterBase(QQmlFilterBasePrivate *privObj, QObject *parent = nullptr);
41 virtual ~QQmlFilterBase() = default;
42
43 bool enabled() const;
44 void setEnabled(const bool bEnable);
45
46 bool isInverted() const;
47 void setInverted(const bool bInvert);
48
49 int column() const;
50 void setColumn(const int column);
51
52 virtual bool filterAcceptsRowInternal(int, const QModelIndex&, const QQmlSortFilterProxyModel *) const { return true; }
53 virtual bool filterAcceptsColumnInternal(int, const QModelIndex&, const QQmlSortFilterProxyModel *) const { return true; }
54 virtual void update(const QQmlSortFilterProxyModel *) { /* do nothing */ };
55
56Q_SIGNALS:
57 void invalidateModel();
58 void invalidateCache(QQmlFilterBase *filter);
59 void enabledChanged();
60 void invertedChanged();
61 void columnChanged();
62
63public slots:
64 void invalidate(bool updateCache = false);
65
66private:
67 Q_DECLARE_PRIVATE(QQmlFilterBase)
68};
69
71{
72 Q_DECLARE_PUBLIC(QQmlFilterBase)
73
74private:
75 bool m_enabled = true;
76 bool m_inverted = false;
77 int m_filterColumn = -1;
78};
79
80QT_END_NAMESPACE
81
82#endif // QQMLFILTERBASE_H