• 13395阅读
  • 2回复

[讨论]QTableWidget的某个格子,如果填写内容过多,如何让它自动换行?就像“记事本”那种自动换行。 [复制链接]

上一主题 下一主题
离线conta
 
只看楼主 倒序阅读 楼主  发表于: 2011-04-12
如题。
站内已经搜过过,找不到有关的帖子。
[ 此帖被conta在2011-04-12 13:37重新编辑 ]
离线linxy

只看该作者 1楼 发表于: 2011-04-13
文档是这样说的:
wordWrap : bool
This property holds the item text word-wrapping policy.
If this property is true then the item text is wrapped where necessary at word-breaks; otherwise it is not wrapped at all. This property is true by default.
Note that even of wrapping is enabled, the cell will not be expanded to fit all text. Ellipsis will be inserted according to the current textElideMode.
This property was introduced in Qt 4.3.
所以说,这个设置是无法达到你想要的效果的。
解决方法:我认为你应该考虑使用QTableView,
具体可以参考:http://www.qtcentre.org/archive/index.php/t-5650.html
希望可以帮到你,如果觉得这个方法可行的话,希望楼主能把实现结果分享一下哈~~~
[ 此帖被linxy在2011-04-13 09:32重新编辑 ]
离线鱼在江湖
只看该作者 2楼 发表于: 2011-04-15
setwordwrap(true)
试试
快速回复
限100 字节
 
上一个 下一个