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
qqmlsorterbase_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 QQMLSORTERBASE_H
6#define QQMLSORTERBASE_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 <QtQml/qqml.h>
20#include <QtCore/QObject>
21#include <QtCore/QAbstractItemModel>
22#include <QtQmlModels/private/qtqmlmodelsglobal_p.h>
23#include <QtQml/private/qqmlcustomparser_p.h>
24
25QT_BEGIN_NAMESPACE
26
27class QQmlSortFilterProxyModel;
29
30class Q_QMLMODELS_EXPORT QQmlSorterBase : public QObject
31{
32 Q_OBJECT
33 Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged FINAL)
34 Q_PROPERTY(Qt::SortOrder sortOrder READ sortOrder WRITE setSortOrder NOTIFY sortOrderChanged FINAL)
35 Q_PROPERTY(int priority READ priority WRITE setPriority NOTIFY priorityChanged FINAL)
36 Q_PROPERTY(int column READ column WRITE setColumn NOTIFY columnChanged FINAL)
37 QML_NAMED_ELEMENT(SorterBase)
38 QML_UNCREATABLE("")
39 QML_ADDED_IN_VERSION(6, 10)
40
41public:
42 explicit QQmlSorterBase(QQmlSorterBasePrivate *privObj, QObject *parent = nullptr);
43 virtual ~QQmlSorterBase() = default;
44
45 bool enabled() const;
46 void setEnabled(const bool enabled);
47
48 Qt::SortOrder sortOrder() const;
49 void setSortOrder(const Qt::SortOrder sortOrder);
50
51 int priority() const;
52 void setPriority(const int priority);
53
54 int column() const;
55 void setColumn(const int column);
56
57 virtual QPartialOrdering compare(const QModelIndex&, const QModelIndex&, const QQmlSortFilterProxyModel *) const = 0;
58 virtual void update(const QQmlSortFilterProxyModel *) { /* do nothing */ }
59
60Q_SIGNALS:
61 void enabledChanged();
62 void sortOrderChanged();
63 void priorityChanged();
64 void columnChanged();
65 void invalidateModel();
66 void invalidateCache(QQmlSorterBase *filter);
67
68public slots:
69 void invalidate(bool updateCache = true);
70
71private:
72 Q_DECLARE_PRIVATE(QQmlSorterBase)
73};
74
76{
77 Q_DECLARE_PUBLIC(QQmlSorterBase)
78
79public:
81 virtual ~QQmlSorterBasePrivate() = default;
82
83 bool m_enabled = true;
86 int m_sortColumn = 0;
87};
88
89QT_END_NAMESPACE
90
91#endif // QQMLSORTERBASE_H
virtual ~QQmlSorterBasePrivate()=default