为什么 QTreeWidget 的顶部有一个 1?
QtreeWidget 的顶部有一个 1。我该如何修复它?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
QtreeWidget 的顶部有一个 1。我该如何修复它?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(3)
值
1
是columncount
属性,默认情况下采用该值。你的问题问得不是很清楚。
如果要修改标签,可以使用 setHeaderLabel/setHeaderLabels 函数。
如果你想隐藏标签,可以使用 setHeaderHidden< /a> 函数。
请在提问之前使用 Qt 文档。
The value
1
is thecolumncount
property, that, by default, assumes that value.Your question was not very clear.
If you want to modify the label, you can use setHeaderLabel/setHeaderLabels functions.
If you want to hide the label, you can use setHeaderHidden function.
Please, before ask, use the Qt documentation.
默认情况下,qt 设计器将 1 放在那里,您需要在 qt 设计器中编辑它以满足您的需要,或者以编程方式使用文档。
By default qt designer puts 1 there, you need to edit it to suit your need from within qt designer or programatically using the docs.
这将更改 qlistwidget 的标题:
self.treeWidget.headerItem().setText(0, QtGui.QApplication.translate("Dialog", "xyz", None, QtGui.QApplication.UnicodeUTF8))
This wll change the title of qlistwidget:
self.treeWidget.headerItem().setText(0, QtGui.QApplication.translate("Dialog", "xyz", None, QtGui.QApplication.UnicodeUTF8))