qt中MVC的model的执行过程分析

将所有的函数打出生成的日志分析:(项目为Qt中的示例EditabletreeModel)

简要的分析后的,执行结果为:

1.准备,不知道干了什么

2.设置列数据(只有两列)

/*columnCount()-headerData   orient1
/*columnCount()-headerData   orient2
每一列的调用如下:

TreeModel::columnCount()
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 13
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 6
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 0
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 1

3.通过index,找到位置,通过data读取数据源中的数据,分别读取不同角色的数据

示例中的数据有六行2列:

/*index一次,data多次,不同的角色row 5 column 0
/*index一次,data多次,不同的角色row 5 column 1

具体的调用过程:

TreeModel::index(int row, int column, const QModelIndex &parent)
row 5 column 0
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
<pre name="code" class="cpp">TreeModel::index(int row, int column, const QModelIndex &parent)
row 5 column 1
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8

 地位一样的列读取数据时,中间没有多余的调用。 

但是要是改变了parent或者换行了就很麻烦:会调用

columnCount(),parent(),rowCount(),flag()等,还会重新调用headerData()重设表头。

4.数据显示出来后,每一次鼠标在上晃过或者其他的变化,视图都会更新一次:

每次更新都重row0到row5(只有六行,即使是树形视图有其他的子树)

每一次执行如下:

(主要是执行flag查看是否可编辑等属性,然后用data更新数据。但是函数中要用到index,所以再此之前要用到index函数,index中的index可能要用得到parent函数)

//row0
/*parent
TreeModel::parent()
TreeModel::parent()
*/
/*index row 0 此处parent变了,要提前获取parent
TreeModel::index(int row, int column, const QModelIndex &parent)
row 0 column 1
TreeModel::index(int row, int column, const QModelIndex &parent)
row 0 column 0
*/
/*flags ,但要用到 index 先index获取索引,但index要用到parent
TreeModel::flags(const QModelIndex &index)
TreeModel::parent()
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
*/

/*index row 0 column 1  此处parent未变
TreeModel::index(int row, int column, const QModelIndex &parent)
row 0 column 1
*/
/*flags ,但要用到 index 先index获取索引
TreeModel::flags(const QModelIndex &index)
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
*/
之后的的都是如此处理,row1,row2等

最后当改变了选中项后,由于选中不同行列表头的显示不同,还要调用headData等函数

全部的日志:

/*不知道干什么
//! [0]
TreeModel::index(int row, int column, const QModelIndex &parent)
row 0 column 0
TreeModel::index(int row, int column, const QModelIndex &parent)
row 0 column 0
TreeModel::index(int row, int column, const QModelIndex &parent)
row 0 column 0
TreeModel::parent()
TreeModel::columnCount()
TreeModel::columnCount()
TreeModel::columnCount()
TreeModel::index(int row, int column, const QModelIndex &parent)
row 0 column 0
TreeModel::index(int row, int column, const QModelIndex &parent)
row 0 column 0
TreeModel::index(int row, int column, const QModelIndex &parent)
row 0 column 0
TreeModel::parent()
TreeModel::columnCount()
TreeModel::rowCount(const QModelIndex &parent)
TreeModel::columnCount()
TreeModel::rowCount(const QModelIndex &parent)
TreeModel::columnCount()
TreeModel::rowCount(const QModelIndex &parent)
TreeModel::index(int row, int column, const QModelIndex &parent)
row 0 column 0
TreeModel::flags(const QModelIndex &index)
TreeModel::flags(const QModelIndex &index)
TreeModel::rowCount(const QModelIndex &parent)
TreeModel::columnCount()
TreeModel::index(int row, int column, const QModelIndex &parent)
row 1 column 0
TreeModel::flags(const QModelIndex &index)
TreeModel::flags(const QModelIndex &index)
TreeModel::rowCount(const QModelIndex &parent)
TreeModel::columnCount()
TreeModel::index(int row, int column, const QModelIndex &parent)
row 2 column 0
TreeModel::flags(const QModelIndex &index)
TreeModel::flags(const QModelIndex &index)
TreeModel::rowCount(const QModelIndex &parent)
TreeModel::columnCount()
TreeModel::index(int row, int column, const QModelIndex &parent)
row 3 column 0
TreeModel::flags(const QModelIndex &index)
TreeModel::flags(const QModelIndex &index)
TreeModel::rowCount(const QModelIndex &parent)
TreeModel::columnCount()
TreeModel::index(int row, int column, const QModelIndex &parent)
row 4 column 0
TreeModel::flags(const QModelIndex &index)
TreeModel::flags(const QModelIndex &index)
TreeModel::rowCount(const QModelIndex &parent)
TreeModel::columnCount()
TreeModel::index(int row, int column, const QModelIndex &parent)
row 5 column 0
TreeModel::flags(const QModelIndex &index)
TreeModel::flags(const QModelIndex &index)
TreeModel::rowCount(const QModelIndex &parent)
TreeModel::columnCount()
//! [0]
//! */

/*columnCount()-headerData   orient1
TreeModel::columnCount()
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 13
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 6
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 0
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 1
*/

/*columnCount()-headerData   orient2
TreeModel::columnCount()
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 13
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 6
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 0
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 1
*/

TreeModel::parent()
TreeModel::columnCount()

/*index一次,data多次,不同的角色row 5 column 0
TreeModel::index(int row, int column, const QModelIndex &parent)
row 5 column 0
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
*/
/*index一次,data多次,不同的角色row 5 column 1
TreeModel::index(int row, int column, const QModelIndex &parent)
row 5 column 1
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
*/

TreeModel::columnCount()
TreeModel::parent()
TreeModel::columnCount()
/*index一次,data多次,不同的角色row 0 column 0
TreeModel::index(int row, int column, const QModelIndex &parent)
row 0 column 0
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
*/
/*index一次,data多次,不同的角色row 0 column 1
TreeModel::index(int row, int column, const QModelIndex &parent)
row 0 column 1
///1
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
///2
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
3
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
//4
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
///5
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
///6
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
//7
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
///8
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
*/

/*headerData
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 13
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 13
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 6
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 0
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 1
TreeModel::columnCount()
TreeModel::rowCount(const QModelIndex &parent)
TreeModel::columnCount()
TreeModel::rowCount(const QModelIndex &parent)
TreeModel::columnCount()
TreeModel::rowCount(const QModelIndex &parent)
TreeModel::index(int row, int column, const QModelIndex &parent)
row 0 column 0
TreeModel::flags(const QModelIndex &index)
TreeModel::flags(const QModelIndex &index)
TreeModel::rowCount(const QModelIndex &parent)
TreeModel::columnCount()
TreeModel::index(int row, int column, const QModelIndex &parent)
row 1 column 0
TreeModel::flags(const QModelIndex &index)
TreeModel::flags(const QModelIndex &index)
TreeModel::rowCount(const QModelIndex &parent)
TreeModel::columnCount()
TreeModel::index(int row, int column, const QModelIndex &parent)
row 2 column 0
TreeModel::flags(const QModelIndex &index)
TreeModel::flags(const QModelIndex &index)
TreeModel::rowCount(const QModelIndex &parent)
TreeModel::columnCount()
TreeModel::index(int row, int column, const QModelIndex &parent)
row 3 column 0
TreeModel::flags(const QModelIndex &index)
TreeModel::flags(const QModelIndex &index)
TreeModel::rowCount(const QModelIndex &parent)
TreeModel::columnCount()
TreeModel::index(int row, int column, const QModelIndex &parent)
row 4 column 0
TreeModel::flags(const QModelIndex &index)
TreeModel::flags(const QModelIndex &index)
TreeModel::rowCount(const QModelIndex &parent)
TreeModel::columnCount()
TreeModel::index(int row, int column, const QModelIndex &parent)
row 5 column 0
TreeModel::flags(const QModelIndex &index)
TreeModel::flags(const QModelIndex &index)
TreeModel::rowCount(const QModelIndex &parent)
TreeModel::columnCount()
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 13
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 6
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 0
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 1
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 13
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 6
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 0
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 1
TreeModel::parent()
TreeModel::columnCount()
TreeModel::index(int row, int column, const QModelIndex &parent)
row 5 column 0
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
TreeModel::index(int row, int column, const QModelIndex &parent)
row 5 column 1
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
TreeModel::columnCount()
TreeModel::parent()
TreeModel::columnCount()
TreeModel::index(int row, int column, const QModelIndex &parent)
row 0 column 0
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8

*/

///共有六行
/*index一次,data多次,不同的角色row 0 column 1
TreeModel::index(int row, int column, const QModelIndex &parent)
row 0 column 1
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
TreeModel::parent()
*/
/*index一次,data多次,不同的角色row 0 column 1
TreeModel::index(int row, int column, const QModelIndex &parent)
row 0 column 1
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
TreeModel::parent()
*/
/*index一次,data多次,不同的角色row 0 column 1
TreeModel::index(int row, int column, const QModelIndex &parent)
row 0 column 1
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
TreeModel::parent()
*/
/*index一次,data多次,不同的角色row 1 column 1
TreeModel::index(int row, int column, const QModelIndex &parent)
row 1 column 1
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
TreeModel::parent()
*/
/*index一次,data多次,不同的角色row 2 column 1
TreeModel::index(int row, int column, const QModelIndex &parent)
row 2 column 1
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
TreeModel::parent()
*/
/*index一次,data多次,不同的角色row 3 column 1
TreeModel::index(int row, int column, const QModelIndex &parent)
row 3 column 1
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
TreeModel::parent()
*/
/*index一次,data多次,不同的角色row 4 column 1
TreeModel::index(int row, int column, const QModelIndex &parent)
row 4 column 1
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
TreeModel::parent()
*/
/*index一次,data多次,不同的角色row 5 column 1
TreeModel::index(int row, int column, const QModelIndex &parent)
row 5 column 1
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
*/

/*headerData
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 13
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 13
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 6
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 0
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 1
TreeModel::columnCount()
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 13
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 6
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 0
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 1
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 13
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 6
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 0
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 1
*/

/*index一次,data多次,不同的角色row 4 column 0
TreeModel::parent()
TreeModel::index(int row, int column, const QModelIndex &parent)
row 4 column 0
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
*/
/*index一次,data多次,不同的角色row 4 column 1
TreeModel::index(int row, int column, const QModelIndex &parent)
row 4 column 1
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
*/
/*index一次,data多次,不同的角色row 3 column 0
TreeModel::parent()
TreeModel::index(int row, int column, const QModelIndex &parent)
row 3 column 0
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
*/
/*index一次,data多次,不同的角色row 3 column 1
TreeModel::index(int row, int column, const QModelIndex &parent)
row 3 column 1
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
*/
/*index一次,data多次,不同的角色row 2 column 0
TreeModel::parent()
TreeModel::index(int row, int column, const QModelIndex &parent)
row 2 column 0
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
*/
/*index一次,data多次,不同的角色row 2 column 1
TreeModel::index(int row, int column, const QModelIndex &parent)
row 2 column 1
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
*/
/*index一次,data多次,不同的角色row 1 column 0
TreeModel::parent()
TreeModel::index(int row, int column, const QModelIndex &parent)
row 1 column 0
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
*/
/*index一次,data多次,不同的角色row 1 column 1
TreeModel::index(int row, int column, const QModelIndex &parent)
row 1 column 1
TreeModel::data(const QModelIndex &index, int role)
role 13
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
*/

/*headerData
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 13
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 6
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 0
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 1
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 13
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 6
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 0
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 1
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 13
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 6
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 0
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 1
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 13
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 6
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 0
TreeModel::headerData(int section, Qt::Orientation orientation,int role)
role 1
*/

/*
TreeModel::flags(const QModelIndex &index)
TreeModel::flags(const QModelIndex &index)
TreeModel::parent()
TreeModel::parent()
TreeModel::index(int row, int column, const QModelIndex &parent)
row 0 column 0
TreeModel::parent()
TreeModel::index(int row, int column, const QModelIndex &parent)
row 0 column 0
TreeModel::flags(const QModelIndex &index)
TreeModel::rowCount(const QModelIndex &parent)
TreeModel::parent()
TreeModel::index(int row, int column, const QModelIndex &parent)
row 0 column 0
*/


*/   ///
//row0
/*parent 
TreeModel::parent()
TreeModel::parent()
*/
/*index row 0 此处parent变了,要提前获取parent
TreeModel::index(int row, int column, const QModelIndex &parent)
row 0 column 1
TreeModel::index(int row, int column, const QModelIndex &parent)
row 0 column 0
*/
/*flags ,但要用到 index 先index获取索引,但index要用到parent
TreeModel::flags(const QModelIndex &index)
TreeModel::parent()
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
*/

/*index row 0 column 1  此处parent未变
TreeModel::index(int row, int column, const QModelIndex &parent)
row 0 column 1
*/
/*flags ,但要用到 index 先index获取索引
TreeModel::flags(const QModelIndex &index)
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
*/

//row1

//row2

//row3
/*parent
TreeModel::parent()
TreeModel::parent()
*/
/*index row 3 此处parent变了,要提前获取parent
TreeModel::index(int row, int column, const QModelIndex &parent)
row 3 column 1
TreeModel::index(int row, int column, const QModelIndex &parent)
row 3 column 0
*/
/*flags ,但要用到 index 先index获取索引,但index要用到parent
TreeModel::flags(const QModelIndex &index)
TreeModel::parent()
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
*/

/*index row 3 column 1   此处parent未变
TreeModel::index(int row, int column, const QModelIndex &parent)
row 3 column 1
*/
/*flags ,但要用到 index 先index获取索引
TreeModel::flags(const QModelIndex &index)
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
*/

/row4
/*parent
TreeModel::parent()
TreeModel::parent()
*/
/*index row 4  此处parent变了,要提前获取parent
TreeModel::index(int row, int column, const QModelIndex &parent)
row 4 column 1
TreeModel::index(int row, int column, const QModelIndex &parent)
row 4 column 0
*/
/*flags ,但要用到 index 先index获取索引
TreeModel::flags(const QModelIndex &index)
TreeModel::parent()
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
*/

/*index row 4 column 1   此处parent未变
TreeModel::index(int row, int column, const QModelIndex &parent)
row 4 column 1
*/
/*flags ,但要用到 index 先index获取索引
TreeModel::flags(const QModelIndex &index)
TreeModel::data(const QModelIndex &index, int role)
role 6
TreeModel::data(const QModelIndex &index, int role)
role 7
TreeModel::data(const QModelIndex &index, int role)
role 9
TreeModel::data(const QModelIndex &index, int role)
role 10
TreeModel::data(const QModelIndex &index, int role)
role 1
TreeModel::data(const QModelIndex &index, int role)
role 0
TreeModel::data(const QModelIndex &index, int role)
role 8
*/




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值