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