This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/doric-Qt/example/doric/resources/scroller.qml

74 lines
1.6 KiB
QML
Raw Normal View History

2021-04-08 19:50:39 +08:00
import QtQuick 2.12
import QtQuick.Controls 2.5
2021-06-16 13:51:45 +08:00
import QtQuick.Layouts 1.14
2021-04-08 19:50:39 +08:00
import "util.mjs" as Util
2021-04-16 10:06:15 +08:00
ScrollView {
2021-04-08 19:50:39 +08:00
property var wrapper
property var uuid: Util.uuidv4()
2021-04-16 10:06:15 +08:00
property var tag: "Scroller"
2021-04-08 19:50:39 +08:00
2021-04-16 16:44:08 +08:00
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ScrollBar.vertical.policy: ScrollBar.AlwaysOff
2021-04-08 19:50:39 +08:00
2021-04-16 10:06:15 +08:00
clip: true
2021-04-08 19:50:39 +08:00
2021-04-16 10:06:15 +08:00
background: Rectangle {
id: bg
color: 'transparent'
2021-04-08 19:50:39 +08:00
}
2021-04-16 10:06:15 +08:00
property var backgroundColor
2021-04-08 19:50:39 +08:00
2021-04-16 10:06:15 +08:00
onBackgroundColorChanged: {
bg.color = backgroundColor
2021-04-08 19:50:39 +08:00
}
property var borderWidth: 0
onBorderWidthChanged: {
bg.border.width = borderWidth
}
property var borderColor: ""
onBorderColorChanged: {
bg.border.color = borderColor
}
2021-04-16 10:06:15 +08:00
onWidthChanged: {
bg.implicitWidth = width
console.log(tag, uuid + " onWidthChanged: " + this.width)
2021-04-08 19:50:39 +08:00
}
2021-04-16 10:06:15 +08:00
onHeightChanged: {
bg.implicitHeight = height
console.log(tag, uuid + " onHeightChanged: " + this.height)
2021-04-08 19:50:39 +08:00
}
2021-04-16 16:44:08 +08:00
onImplicitWidthChanged: {
console.log(tag, uuid + " onImplicitWidthChanged: " + this.implicitWidth)
}
onImplicitHeightChanged: {
console.log(tag, uuid + " onImplicitHeightChanged: " + this.implicitHeight)
}
onContentWidthChanged: {
console.log(tag, uuid + " onContentWidthChanged: " + this.contentWidth)
}
onContentHeightChanged: {
console.log(tag, uuid + " onContentHeightChanged: " + this.contentHeight)
}
MouseArea {
anchors.fill: parent
onClicked: {
console.log(tag, uuid + " wrapper: " + wrapper)
mouseAreaBridge.onClick(wrapper)
}
}
2021-04-08 19:50:39 +08:00
}