DAWorkbench 0.0.1
DAWorkbench API
载入中...
搜索中...
未找到
DA::DATreeModel类 参考

针对DATree的通用model 更多...

#include <DATreeModel.h>

类 DA::DATreeModel 继承关系图:

Public 成员函数

 DATreeModel (QObject *par=nullptr, int colCount=1)
 
 DATreeModel (DATree *t, QObject *par=nullptr, int colCount=1)
 
QModelIndex index (int row, int column, const QModelIndex &parent) const override
 
QModelIndex parent (const QModelIndex &index) const override
 
int rowCount (const QModelIndex &p) const override
 
int columnCount (const QModelIndex &parent) const override
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 表头
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 
QVariant data (const QModelIndex &index, int role) const override
 
void update ()
 强制刷新
 
virtual QVariant dataTreeItem (DATreeItem *i, const QModelIndex &index, int role) const
 针对DATreeItem的data重载
 
void setColumnCount (int col)
 设置列的数量
 
void setHeaderLabel (int column, const QString &s)
 设置表头
 
void setTree (DATree *t)
 设置树
 
DATreegetTree ()
 获取树的指针
 
const DATreegetTree () const
 获取树的指针
 
DATreeItemindexToItem (const QModelIndex &index) const
 
QModelIndex itemToIndex (const DATreeItem *i) const
 

详细描述

针对DATree的通用model

成员函数说明

◆ dataTreeItem()

QVariant DATreeModel::dataTreeItem ( DATreeItem i,
const QModelIndex &  index,
int  role 
) const
virtual

针对DATreeItem的data重载

参数
i
index
role
返回

◆ getTree() [1/2]

DATree * DATreeModel::getTree ( )

获取树的指针

返回

◆ getTree() [2/2]

const DATree * DATreeModel::getTree ( ) const

获取树的指针

返回

◆ headerData()

QVariant DATreeModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
override

表头

参数
section
orientation
role
返回

◆ setColumnCount()

void DATreeModel::setColumnCount ( int  col)

设置列的数量

参数
col列的数量

◆ setHeaderLabel()

void DATreeModel::setHeaderLabel ( int  column,
const QString &  s 
)

设置表头

参数
column如果column大于设置的列数量,此函数无响应
s

◆ setTree()

void DATreeModel::setTree ( DATree t)

设置树

注解
此操作并不会把之前设置的数销毁
参数
t

该类的文档由以下文件生成: