使用qt5.15.2版本,ScrollView的contentHeight、contentWidth要设值才能自动出现滚动条,下面上代码,绘制了一个简易波浪图:
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
Rectangle {
id: root
visible: true
color: "white"
clip: true
ColumnLayout {
id: mainColumn
anchors.fill: parent
Rectangle {
height: 60
Layout.fillWidth: true
}
ScrollView {
id: dataDetailsScrollView
Layout.fillWidth: true
Layout.fillHeight: true
Layout.rightMargin: 10
Layout.bottomMargin: 10
Layout.leftMargin: 10
clip: true
contentHeight: 500