Freeciv21
Develop your civilization from humble roots to a global empire
collated_sort_proxy.h
Go to the documentation of this file.
1 /*
2  * SPDX-License-Identifier: GPLv3-or-later
3  * SPDX-FileCopyrightText: Louis Moureaux <m_louis30@yahoo.com>
4  */
5 
6 #pragma once
7 
8 #include <QCollator>
9 #include <QSortFilterProxyModel>
10 
11 namespace freeciv {
12 
13 class collated_sort_filter_proxy_model : public QSortFilterProxyModel {
14  QCollator m_collator;
15 
16 public:
17  collated_sort_filter_proxy_model(QObject *parent = nullptr);
18 
20  QCollator collator() const { return m_collator; }
21  void set_collator(const QCollator &coll);
22 
23 protected:
24  bool lessThan(const QModelIndex &source_left,
25  const QModelIndex &source_right) const override;
26 };
27 
28 } // namespace freeciv
A sort and filter proxy model supporting string collation.
QCollator collator() const
Retrieves the string collator currently in use.
void set_collator(const QCollator &coll)
Changes the collator currently in use.
bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override
Reimplemented protected function.
collated_sort_filter_proxy_model(QObject *parent=nullptr)
Constructor.
Definition: path.cpp:10