QML ScrollView使用Rectangle没有下拉条解决方法

来源:互联网 发布:网络信号大师 编辑:程序博客网 时间:2024/06/05 06:02

在使用QML的ScrollView时,若像官方一样 使用Label,listView等控件的时候,是可以正常出现滚动条的,但是使用Rectangle的时候,是不会正常出现滚动条的

  ScrollView{
            id: scView
            height: stView.width
            width: stView.width
            clip: true
            IndexPage{
                   id: c
                   height: 900
                  width: rightV.width
  }
         }
效果如下

可见右边是没有滚动条的,这时需要给ScrollView一个layout

 ScrollView{
            id: scView
            height: stView.width
            width: stView.width
            clip: true
            ColumnLayout{
                 height: 1000
                 width: scView.width
             IndexPage{
                    id: c
                    height: 900
                    width: rightV.width
            }
         }
       }
这样 滚动条就出现了


原创粉丝点击