在使用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
}
}
}
这样 滚动条就出现了