From 9306786beb47674eb37c2849e9f823579c94e8db Mon Sep 17 00:00:00 2001 From: Andrew nuark G Date: Sun, 10 Jan 2021 21:24:06 +0700 Subject: [PATCH] Add docs for viewmodels --- sea_transport/viewmodels/cargoviewmodel.h | 42 +++++++++++++++++++ .../viewmodels/deliverypointsviewmodel.h | 40 ++++++++++++++++++ sea_transport/viewmodels/usersviewmodel.h | 40 ++++++++++++++++++ sea_transport/viewmodels/vesselsviewmodel.h | 40 ++++++++++++++++++ 4 files changed, 162 insertions(+) diff --git a/sea_transport/viewmodels/cargoviewmodel.h b/sea_transport/viewmodels/cargoviewmodel.h index 4190382..7af57b9 100644 --- a/sea_transport/viewmodels/cargoviewmodel.h +++ b/sea_transport/viewmodels/cargoviewmodel.h @@ -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 _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 &new_data); }; diff --git a/sea_transport/viewmodels/deliverypointsviewmodel.h b/sea_transport/viewmodels/deliverypointsviewmodel.h index d7c836d..35ea8af 100644 --- a/sea_transport/viewmodels/deliverypointsviewmodel.h +++ b/sea_transport/viewmodels/deliverypointsviewmodel.h @@ -6,18 +6,58 @@ #include +/** + * @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(); }; diff --git a/sea_transport/viewmodels/usersviewmodel.h b/sea_transport/viewmodels/usersviewmodel.h index e0693e6..97ba04f 100644 --- a/sea_transport/viewmodels/usersviewmodel.h +++ b/sea_transport/viewmodels/usersviewmodel.h @@ -6,18 +6,58 @@ #include +/** + * @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(); }; diff --git a/sea_transport/viewmodels/vesselsviewmodel.h b/sea_transport/viewmodels/vesselsviewmodel.h index b50aba0..343d53a 100644 --- a/sea_transport/viewmodels/vesselsviewmodel.h +++ b/sea_transport/viewmodels/vesselsviewmodel.h @@ -6,18 +6,58 @@ #include +/** + * @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(); };