本文介绍了如何设置QListWidgetItem的最小高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何设置QListWidgetItem
的最小高度?我正在使用QListWidget::setItemWidget()
和自定义的小部件,尽管我明确声明了我的自定义小部件的最小高度,但这些QListWidgetItem
仍然具有相当低的height属性.
How can I set the minimum height of a QListWidgetItem
? I'm using QListWidget::setItemWidget()
with a customized widget, and although I explicitly declared minimum height of my customized widget, those QListWidgetItem
s still have a pretty low height attribute.
推荐答案
在项目上使用setSizeHint
.
void QListWidgetItem::setSizeHint ( const QSize & size )
这是一种正确的方法,可以告诉委托人它必须为该项目保留多少屏幕.
This is the right method for telling the delegate how much screen it must preserve for the item.
查看 http://qt-project.org/doc/qt-4.8/qlistwidgetitem .html#setSizeHint
这篇关于如何设置QListWidgetItem的最小高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!