• 4812阅读
  • 1回复

关于QScrollView的疑问 [复制链接]

上一主题 下一主题
离线larryzhao
 

只看楼主 倒序阅读 楼主  发表于: 2006-05-23
我发现如果QScrollView addchild一个比他本身大得widget的话,会自动出来滚动条的,可是如果加入多个比他本身小的widget而越界的话就不会自动出来滚动条,比如说我往一个200, 200的QScrollView里面垂直加入20个height为40的label,滚动条就不会自动出来的。

应该怎么样才能让他自动出来滚动条呢?高手们帮帮我,谢谢了.

PS:我试过往ScrollView里面加入一个VBoxLayout,然后再添加label,可是这样的话layout就会把我的ScrollView撑到20*40正好的大小....我真不知道该怎么弄了...
[ 此贴被XChinux在2006-05-23 18:01重新编辑 ]
离线shiroki

只看该作者 1楼 发表于: 2006-05-24
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
--
shiro is White
ki is tree
http://www.cuteqt.com
论坛 http://www.cuteqt.com/bbs
博客 http://www.cuteqt.com/blog
博客镜像: http://sites.cuteqt.com/cuteqt
Linux/Qt/嵌入式讨论群 http://qun.qq.com/air/5699823
快速回复
限100 字节
 
上一个 下一个