Custom table model to represent a list of Package objects.
More...
#include <packagetablemodel.h>
|
| | PackageTableModel (QList< Package > *packageList, QObject *parent=nullptr) |
| | Constructs a new table model with a given list of packages and parent.
|
| |
| 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.
|
| |
| int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
| | Returns the number of rows under the given parent.
|
| |
| int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
| | Returns the number of columns under the given parent.
|
| |
| 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.
|
| |
| void | addPackage (const Package &package) |
| | Adds a new package to the table model.
|
| |
Custom table model to represent a list of Package objects.
The PackageTableModel class provides functionalities to represent and manage a list of Package objects in a table view, building upon Qt's QAbstractTableModel.
◆ PackageTableModel()
| PackageTableModel::PackageTableModel |
( |
QList< Package > * |
packageList, |
|
|
QObject * |
parent = nullptr |
|
) |
| |
|
explicit |
Constructs a new table model with a given list of packages and parent.
- Parameters
-
| packageList | Pointer to the list of packages. |
| parent | The parent QObject. |
◆ addPackage()
| void PackageTableModel::addPackage |
( |
const Package & |
package | ) |
|
Adds a new package to the table model.
- Parameters
-
| package | The package to add. |
◆ columnCount()
| int PackageTableModel::columnCount |
( |
const QModelIndex & |
parent = QModelIndex() | ) |
const |
|
override |
Returns the number of columns under the given parent.
- Parameters
-
| parent | The parent QModelIndex. |
- Return values
-
◆ data()
| QVariant PackageTableModel::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.
- Parameters
-
| index | The QModelIndex. |
| role | The role of the data. |
- Return values
-
| QVariant | Data for the given role and index. |
◆ headerData()
| QVariant PackageTableModel::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.
- Parameters
-
| section | The section of the header. |
| orientation | Horizontal or Vertical. |
| role | The role of the data. |
- Return values
-
| QVariant | Data for the given role and section. |
◆ rowCount()
| int PackageTableModel::rowCount |
( |
const QModelIndex & |
parent = QModelIndex() | ) |
const |
|
override |
Returns the number of rows under the given parent.
- Parameters
-
| parent | The parent QModelIndex. |
- Return values
-
The documentation for this class was generated from the following files: