Add docs for Workers ViewModel
This commit is contained in:
parent
407121697a
commit
a120d7fd87
1 changed files with 55 additions and 0 deletions
|
|
@ -10,23 +10,78 @@
|
||||||
#include "../objects/user.h"
|
#include "../objects/user.h"
|
||||||
#include "../db/database.h"
|
#include "../db/database.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ViewModel для таблицы рабочих
|
||||||
|
*
|
||||||
|
*/
|
||||||
class WorkersViewModel : public QAbstractTableModel {
|
class WorkersViewModel : public QAbstractTableModel {
|
||||||
private:
|
private:
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
//! Список рабочих
|
||||||
QVector<User> mUserData;
|
QVector<User> mUserData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Возвращает строковое представление профессии пользователя по индексу \param pIdx
|
||||||
|
*
|
||||||
|
* @param user пользовател
|
||||||
|
* @param pIdx индекс профессии
|
||||||
|
* @return QString строковое представление профессии
|
||||||
|
*/
|
||||||
QString getProfessionAt(const User &user, int pIdx) const;
|
QString getProfessionAt(const User &user, int pIdx) const;
|
||||||
|
/**
|
||||||
|
* @brief Возвращает флаг, должна ли клетка таблицы иметь полужирный шрифт
|
||||||
|
*
|
||||||
|
* @param index индекс модели
|
||||||
|
* @return true должен быть полужирным
|
||||||
|
* @return false не должен быть полужирным
|
||||||
|
*/
|
||||||
bool shouldBeBold(const QModelIndex &index) const;
|
bool shouldBeBold(const QModelIndex &index) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Стандартный конструктор объекта класса
|
||||||
|
*
|
||||||
|
* @param parent родитель, для определения периодов жизни ViewModel
|
||||||
|
*/
|
||||||
WorkersViewModel(QObject *parent);
|
WorkersViewModel(QObject *parent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Возвращает кол-во строк в таблице
|
||||||
|
*
|
||||||
|
* @param parent [ignored]
|
||||||
|
* @return int кол-во строк в таблице
|
||||||
|
*/
|
||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
|
/**
|
||||||
|
* @brief Возвращает кол-во столбцов в таблице
|
||||||
|
*
|
||||||
|
* @param parent [ignored]
|
||||||
|
* @return int кол-во столбцов в таблице
|
||||||
|
*/
|
||||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
|
/**
|
||||||
|
* @brief Возвращает содержимое заголовка таблицы
|
||||||
|
*
|
||||||
|
* @param section [ignored]
|
||||||
|
* @param orientation положение заголовка таблицы
|
||||||
|
* @param role [ignored]
|
||||||
|
* @return QVariant содержимое заголовка
|
||||||
|
*/
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||||
|
/**
|
||||||
|
* @brief Возвращает содержимое ячеек таблицы
|
||||||
|
*
|
||||||
|
* @param index индекс текущей ячейки
|
||||||
|
* @param role какая часть таблицы отрисовывается (данные, стили и т.д.)
|
||||||
|
* @return QVariant содержимое ячейки
|
||||||
|
*/
|
||||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Запускает перерисовку таблицы
|
||||||
|
*
|
||||||
|
*/
|
||||||
void invalidateData();
|
void invalidateData();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue