标题:关于QScrollView的疑问
作者:larryzhao
日期:2006-05-23 17:53
内容:
我发现如果QScrollView addchild一个比他本身大得widget的话,会自动出来滚动条的,可是如果加入多个比他本身小的widget而越界的话就不会自动出来滚动条,比如说我往一个200, 200的QScrollView里面垂直加入20个height为40的label,滚动条就不会自动出来的。
应该怎么样才能让他自动出来滚动条呢?高手们帮帮我,谢谢了.
PS:我试过往ScrollView里面加入一个VBoxLayout,然后再添加label,可是这样的话layout就会把我的ScrollView撑到20*40正好的大小....我真不知道该怎么弄了...
#1 [shiroki 05-24 17:12]
http://doc.trolltech.com/2.3/qscrollview.html#details
"To provide content for the widget, inherit from QScrollView and reimplement drawContents(), and use resizeContents() to set the size of the viewed area. Use addChild() / moveChild() to position widgets on the view."
重写resizeContents