QTableView 中未显示的行数
我有这个表视图,其中显示了 3 列的一些数据。我知道每一行应该自动由表编号,如:
_ column_1 column_2 column_3
1 data_1 data_2 data_3
2 data_1 data_2 data_3
.....
我的问题是行号没有出现。有什么功能我必须启用吗?
我试过
表.verticalHeader.show();
但它不起作用。
I have this table view in which I display some data on 3 columns. I know that each row should automatically be numbered by the table like:
_ column_1 column_2 column_3
1 data_1 data_2 data_3
2 data_1 data_2 data_3
.....
My problem is that the row number doesn't appear. Is there some function that I have to enable?
I tried
table.verticalHeader.show();
But it is not working.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我有同样的问题,即行号和标题部分之间的冲突,但我已经解决了。
您可以保留 headerData 重写函数,但要小心,该函数将被水平和垂直标题调用,而不仅仅是水平,因此正确的实现是:
I have the same issue i.e. conflict between row number and header section, but I have solved it.
You can keep your headerData overriding function but be careful this fucntion will be called for the horizontal and vertical header not only horizontal, so the right implementation is:
知道了。我为表视图重新实现了 headerData 函数,但不知何故,行号和列标题之间存在冲突,并且行号被遮挡。我评论了该函数,现在行号出现了。
Got it. I re-implemented the headerData function for my table view and somehow there was a conflict between the row numbers and the column headers and the row numbers got obscured. I commented the function and now the row numbers appear.