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