• 5525阅读
  • 0回复

在QTreeWidget中通过模型insertColumn插入一行,为何不能在前面插入 [复制链接]

上一主题 下一主题
离线ldqiang
 
只看楼主 倒序阅读 楼主  发表于: 2008-10-06
— 本帖被 XChinux 执行加亮操作(2008-10-06) —
在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)设置过但是还是一样,谢谢大家指点一下。
快速回复
限100 字节
 
上一个 下一个