KOSMIndoorMap

amenitysortfilterproxymodel.h
1/*
2 SPDX-FileCopyrightText: 2023 Volker Krause <vkrause@kde.org>
3 SPDX-License-Identifier: LGPL-2.0-or-later
4*/
5
6#ifndef KOSMINDOORMAP_AMENITYSORTFILTERMODEL_H
7#define KOSMINDOORMAP_AMENITYSORTFILTERMODEL_H
8
9#include <QCollator>
10#include <QSortFilterProxyModel>
11
12namespace KOSMIndoorMap {
13
14/** Filtering/sorting on top of the AmenityModel.
15 * - filters on all visible roles
16 * - sorts while keeping the grouping intact
17 */
19{
21 Q_PROPERTY(QString filterString MEMBER m_filter NOTIFY filterStringChanged)
22
23public:
24 explicit AmenitySortFilterProxyModel(QObject *parent = nullptr);
26
28 void filterStringChanged();
29
30protected:
31 [[nodiscard]] bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
32 [[nodiscard]] bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override;
33
34private:
35 bool filterMatches(const QString &s) const;
36
37 QCollator m_collator;
38 QString m_filter;
39};
40
41}
42
43#endif
Filtering/sorting on top of the AmenityModel.
OSM-based multi-floor indoor maps for buildings.
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:20:03 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.