NetSim 1.0.0
An educational network simulation software for students
Loading...
Searching...
No Matches
packagetablemodel.h
Go to the documentation of this file.
1#ifndef PACKAGETABLEMODEL_H
2#define PACKAGETABLEMODEL_H
3
5#include <QAbstractTableModel>
6
10
11namespace NetSim {
12
15
25class PackageTableModel : public QAbstractTableModel {
26 Q_OBJECT
27
28public:
36 explicit PackageTableModel(QList<Package> *packageList,
37 QObject *parent = nullptr);
38
48 QVariant headerData(int section, Qt::Orientation orientation,
49 int role = Qt::DisplayRole) const override;
50
57 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
58
65 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
66
75 QVariant data(const QModelIndex &index,
76 int role = Qt::DisplayRole) const override;
77
83 void addPackage(const Package &package);
84
85private:
87 QList<Package> *m_packageList{nullptr};
88};
89} // namespace NetSim
90
91#endif // PACKAGETABLEMODEL_H
Represents a network package.
Definition package.h:28
Custom table model to represent a list of Package objects.
Definition packagetablemodel.h:25
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of columns under the given parent.
Definition packagetablemodel.cpp:42
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of rows under the given parent.
Definition packagetablemodel.cpp:35
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Returns the data stored under the given role for the item referred to by the index.
Definition packagetablemodel.cpp:49
void addPackage(const Package &package)
Adds a new package to the table model.
Definition packagetablemodel.cpp:97
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Returns the data for the given role and section in the header with the specified orientation.
Definition packagetablemodel.cpp:10
Definition logger.h:12
Contains the Package class definition.