This repository has been archived on 2023-08-11. You can view files and clone it, but cannot push or open issues or pull requests.
verticallite/statloodsmanmodel.h

88 lines
2.9 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef STATLOODSMANMODEL_H
#define STATLOODSMANMODEL_H
#include <QAbstractItemModel>
#include <QStringList>
#include "treenode.h"
#include "midasdata.h"
class StatLoodsmanModel : public QAbstractItemModel
{
Q_OBJECT
public:
explicit StatLoodsmanModel(QObject *parent = 0);
~StatLoodsmanModel();
//! Возращает хранимые данные
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
//! Устанавливает значение для указанной записи
bool setData(const QModelIndex &index, const QVariant &value, int role);
//! Возвращает флаг записи
Qt::ItemFlags flags(const QModelIndex &index) const;
//! Возращает название заголовка
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
//! Устанавливает название заголовка
bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role);
//! Возращает индекс модели для строки и колонки
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
//! Возращает индекс родителя
QModelIndex parent(const QModelIndex &index) const ;
//! Возращает количество строк в индексе родителя
int rowCount(const QModelIndex &parent = QModelIndex()) const;
//! Возращает количество столбцов в индексе родителя
int columnCount(const QModelIndex &parent = QModelIndex()) const;
/*
//! Удаление строки
bool removeRows(int position, int rows, const QModelIndex &parent);
//! Вставка строки
bool insertRows(int position, int rows, const QModelIndex &parent);
*/
//! Проверка имеются ли дети
bool hasChildren(const QModelIndex & parent) const ;
//! Получение TreeItem по индексу
TreeNode *getItem(const QModelIndex &index) const;
//! Проверка можно ли провести ленивыю инициализацию
bool canFetchMore(const QModelIndex &parent) const;
//! Ленивая инициализация
void fetchMore(const QModelIndex &parent);
//! Получение списка полей с данных
QStringList fields() ;
//! Установка списка полей данных
void setFields(const QStringList& dataFields );
void setFieldIcon(QString column);
int fieldIndex(const QString &fieldName) const;
private:
TreeNode* m_root;
MidasData* dataSet;
//! Список полей данных
QStringList m_fieldNames;
//! Поле с Иконкой
QString m_fieldIcon;
mutable QHash<long, TreeNode*> cache;
signals:
public slots:
};
#endif // STATLOODSMANMODEL_H