Add docs for viewmodels
This commit is contained in:
parent
b9255d6b77
commit
9306786beb
4 changed files with 162 additions and 0 deletions
|
|
@ -7,19 +7,61 @@
|
|||
#include "entities/cargo_entity.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief Cargo ViewModel class
|
||||
*
|
||||
*/
|
||||
class CargoViewModel : public QAbstractTableModel {
|
||||
private:
|
||||
Q_OBJECT
|
||||
|
||||
//! Collection of cargo for ViewModel
|
||||
QVector<cargo_entity> _data;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Cargo View Model object
|
||||
*
|
||||
* @param parent [ignored]
|
||||
*/
|
||||
CargoViewModel(QObject *parent);
|
||||
/**
|
||||
* @brief Returns row count
|
||||
*
|
||||
* @param parent [ignored]
|
||||
* @return int
|
||||
*/
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
/**
|
||||
* @brief Returns column count
|
||||
*
|
||||
* @param parent [ignored]
|
||||
* @return int
|
||||
*/
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
/**
|
||||
* @brief Returns data about header
|
||||
*
|
||||
* @param section header section
|
||||
* @param orientation header orientation
|
||||
* @param role header cell role
|
||||
* @return QVariant
|
||||
*/
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
/**
|
||||
* @brief Returns data about cells
|
||||
*
|
||||
* @param index cell index
|
||||
* @param role draw role
|
||||
* @return QVariant
|
||||
*/
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
|
||||
/**
|
||||
* @brief Sets cargo collection
|
||||
*
|
||||
* @param new_data
|
||||
*/
|
||||
void set_data(const QVector<cargo_entity> &new_data);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -6,18 +6,58 @@
|
|||
#include <QAbstractTableModel>
|
||||
|
||||
|
||||
/**
|
||||
* @brief Delivery point ViewModel class
|
||||
*
|
||||
*/
|
||||
class DeliveryPointsViewModel : public QAbstractTableModel {
|
||||
private:
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Delivery point View Model object
|
||||
*
|
||||
* @param parent [ignored]
|
||||
*/
|
||||
DeliveryPointsViewModel(QObject *parent = nullptr);
|
||||
/**
|
||||
* @brief Returns row count
|
||||
*
|
||||
* @param parent [ignored]
|
||||
* @return int
|
||||
*/
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
/**
|
||||
* @brief Returns column count
|
||||
*
|
||||
* @param parent [ignored]
|
||||
* @return int
|
||||
*/
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
/**
|
||||
* @brief Returns data about header
|
||||
*
|
||||
* @param section header section
|
||||
* @param orientation header orientation
|
||||
* @param role header cell role
|
||||
* @return QVariant
|
||||
*/
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
/**
|
||||
* @brief Returns data about cells
|
||||
*
|
||||
* @param index cell index
|
||||
* @param role draw role
|
||||
* @return QVariant
|
||||
*/
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* @brief Update slot, may becalled then redraw needed
|
||||
*
|
||||
*/
|
||||
void update();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -6,18 +6,58 @@
|
|||
#include <QAbstractTableModel>
|
||||
|
||||
|
||||
/**
|
||||
* @brief Users ViewModel class
|
||||
*
|
||||
*/
|
||||
class UsersViewModel : public QAbstractTableModel {
|
||||
private:
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Users View Model object
|
||||
*
|
||||
* @param parent [ignored]
|
||||
*/
|
||||
UsersViewModel(QObject *parent = nullptr);
|
||||
/**
|
||||
* @brief Returns row count
|
||||
*
|
||||
* @param parent [ignored]
|
||||
* @return int
|
||||
*/
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
/**
|
||||
* @brief Returns column count
|
||||
*
|
||||
* @param parent [ignored]
|
||||
* @return int
|
||||
*/
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
/**
|
||||
* @brief Returns data about header
|
||||
*
|
||||
* @param section header section
|
||||
* @param orientation header orientation
|
||||
* @param role header cell role
|
||||
* @return QVariant
|
||||
*/
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
/**
|
||||
* @brief Returns data about cells
|
||||
*
|
||||
* @param index cell index
|
||||
* @param role draw role
|
||||
* @return QVariant
|
||||
*/
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* @brief Update slot, may be called then redraw needed
|
||||
*
|
||||
*/
|
||||
void update();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -6,18 +6,58 @@
|
|||
#include <QAbstractTableModel>
|
||||
|
||||
|
||||
/**
|
||||
* @brief Vessels ViewModel class
|
||||
*
|
||||
*/
|
||||
class VesselsViewModel : public QAbstractTableModel {
|
||||
private:
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Vessels View Model object
|
||||
*
|
||||
* @param parent [ignored]
|
||||
*/
|
||||
VesselsViewModel(QObject *parent = nullptr);
|
||||
/**
|
||||
* @brief Returns row count
|
||||
*
|
||||
* @param parent [ignored]
|
||||
* @return int
|
||||
*/
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
/**
|
||||
* @brief Returns column count
|
||||
*
|
||||
* @param parent [ignored]
|
||||
* @return int
|
||||
*/
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
/**
|
||||
* @brief Returns data about header
|
||||
*
|
||||
* @param section header section
|
||||
* @param orientation header orientation
|
||||
* @param role header cell role
|
||||
* @return QVariant
|
||||
*/
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
/**
|
||||
* @brief Returns data about cells
|
||||
*
|
||||
* @param index cell index
|
||||
* @param role draw role
|
||||
* @return QVariant
|
||||
*/
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* @brief Update slot, may be called then redraw needed
|
||||
*
|
||||
*/
|
||||
void update();
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue