在QTreeWidget中通过模型insertColumn插入一行,为何不能在前面插入,每次总是插入在列的最后,如下
QStringList labels;
labels << "x" << "y" << "z";
this->ui.treeWidget->setHeaderLabels(labels);
//以下设置插入行
this->ui.treeWidget->model()->insertcolumn(1);//在第一列后插入一列,但是显示效果却是在最后插入,1并未起作用,还有就是文档上是这样写的:
bool QAbstractItemModel::insertColumn ( int column, const QModelIndex & parent = QModelIndex() )
Inserts a single column before the given column in the child items of the parent specified. Returns true if the column is inserted; otherwise returns false.
我想问一下,是否模型索引要设置一下,我在用的时候也试过了,用最顶上的索引(-1,-1)设置过但是还是一样,谢谢大家指点一下。