[英]How can i setStyleSheet in QML?(only QML no C++)
我想創建一個自定義滾動條。
這是我的代碼,我想在Qml中使用ScrollBar組件。
Rectangle {
id: frame
clip: true
width: 160
height: 160
border.color: "black"
anchors.centerIn: parent
Text {
id: content
text: "ABC"
font.pixelSize: 160
x: -hbar.position * width
y: -vbar.position * height
}
ScrollBar {
id: vbar
hoverEnabled: true
active: hovered || pressed
orientation: Qt.Vertical
size: frame.height / content.height
anchors.top: parent.top
anchors.right: parent.right
anchors.bottom: parent.bottom
}
}
就我而言,我想用Scrollbar image創建。
我嘗試了“ source:“ ./bar.bng” ”,但是它說ScrollBar沒有參數“ source”。 我如何使用自定義圖像。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.