6#include <QAbstractTableModel>
30class Bands final :
public QAbstractTableModel {
32 using Frequency = Radio::Frequency;
35 class const_iterator {
37 const_iterator(
int row) : row_{row} {}
47 explicit Bands(QObject *parent =
nullptr);
52 QString
find(Frequency)
const;
53 int find(QString
const &)
const;
54 bool findFreq(QString
const &band, Radio::Frequency *pFreqLower,
55 Radio::Frequency *pFreqHigher)
const;
57 static QString
const &
oob();
64 static int constexpr SortRole = Qt::UserRole;
67 int rowCount(QModelIndex
const &parent = QModelIndex{})
const override;
68 int columnCount(QModelIndex
const &parent = QModelIndex{})
const override;
69 Qt::ItemFlags
flags(QModelIndex
const & = QModelIndex{})
const override;
70 QVariant
headerData(
int section, Qt::Orientation,
71 int = Qt::DisplayRole)
const override;
79 QVariant
data(QModelIndex
const &,
80 int role = Qt::DisplayRole)
const override;
QString operator*()
Dereference the iterator to get the band name.
Definition Bands.cpp:292
const_iterator & operator++()
Increment the iterator.
Definition Bands.cpp:309
bool operator!=(const_iterator const &) const
Compare two iterators for inequality.
Definition Bands.cpp:300
QString find(Frequency) const
Find the band that contains the given frequency.
Definition Bands.cpp:76
static QString const & oob()
Get Out Of Band name.
Definition Bands.cpp:133
bool findFreq(QString const &band, Radio::Frequency *pFreqLower, Radio::Frequency *pFreqHigher) const
Find the frequency bounds for the given band name.
Definition Bands.cpp:113
Qt::ItemFlags flags(QModelIndex const &=QModelIndex{}) const override
Get item flags for the given index.
Definition Bands.cpp:161
int columnCount(QModelIndex const &parent=QModelIndex{}) const override
Get number of columns in the model.
Definition Bands.cpp:151
const_iterator begin() const
Get begin iterator.
Definition Bands.cpp:319
int rowCount(QModelIndex const &parent=QModelIndex{}) const override
Get number of rows in the model.
Definition Bands.cpp:141
const_iterator end() const
Get end iterator.
Definition Bands.cpp:326
QVariant data(QModelIndex const &, int role=Qt::DisplayRole) const override
Get data for the given index and role.
Definition Bands.cpp:172
QVariant headerData(int section, Qt::Orientation, int=Qt::DisplayRole) const override
Get header data for the given section, orientation, and role.
Definition Bands.cpp:264