Kstars

catalogobjectlistmodel.h
1/*
2 SPDX-FileCopyrightText: 2021 Valentin Boettcher Jason Harris <hiro at protagon.space; @hiro:tchncs.de>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8#include <QAbstractTableModel>
9#include "catalogobject.h"
10
11class CatalogObjectListModel : public QAbstractTableModel
12{
14 public:
15 CatalogObjectListModel(QObject *parent = nullptr,
16 std::vector<CatalogObject> objects = {});
17
18 inline int rowCount(const QModelIndex & = QModelIndex()) const override
19 {
20 return m_objects.size();
21 };
22
23 inline int columnCount(const QModelIndex & = QModelIndex()) const override
24 {
25 return 11;
26 };
27
28 QVariant headerData(int section, Qt::Orientation orientation,
29 int role = Qt::DisplayRole) const override;
30
31 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
32
33 void setObjects(std::vector<CatalogObject> objects);
34
35 inline const CatalogObject &getObject(const QModelIndex &index) const
36 {
37 return m_objects.at(index.row());
38 };
39
40 private:
41 std::vector<CatalogObject> m_objects;
42};
A simple container object to hold the minimum information for a Deep Sky Object to be drawn on the sk...
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const override
int row() const const
Q_OBJECTQ_OBJECT
QObject * parent() const const
DisplayRole
Orientation
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:42 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.