• 6634阅读
  • 5回复

如何设置QListWidget中text在QListWidgetItem的位置? [复制链接]

上一主题 下一主题
离线majiwei
 

只看楼主 倒序阅读 楼主  发表于: 2009-09-22
QListWidgetItem中的text默认是左对齐的。有没有方法可以在左边留出几个像素的空?不要说手动打空格,我需要精确到像素。
有知道的请共享一下,我是新手~大家帮帮忙。
离线jorneyr

只看该作者 1楼 发表于: 2009-09-22
新手说话还这么牛B,自己搞去吧。
离线majiwei

只看该作者 2楼 发表于: 2009-09-22
会的话就帮帮忙。我的意思就是不要想投机的方法。
离线majiwei

只看该作者 3楼 发表于: 2009-09-22
有知道的吗?帖子沉的可真快。
离线majiwei

只看该作者 4楼 发表于: 2009-09-22
没人知道吗?在线等呢~~
离线majiwei

只看该作者 5楼 发表于: 2009-09-23
我问了QT的技术支持,他们给我的答复:
You can achieve this by using QStyledItemDelegate to manage the items in the list view. A styled delegate allows you more control over the appearance of items in the list. You would create a subclass of QStyledItemDelegate, set it on the view and reimplement drawText():-


http://doc.trolltech.com/4.5/qstyleditemdelegate.html#displayText
Let me know if you have further questions.

有同样问题的朋友可以参考一下。
快速回复
限100 字节
 
上一个 下一个