2021-02-02 20:42:37 +08:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.5
|
2021-03-15 15:30:17 +08:00
|
|
|
import QtQuick.Layouts 1.15
|
2021-04-27 10:32:42 +08:00
|
|
|
import QtGraphicalEffects 1.12
|
2021-02-02 20:42:37 +08:00
|
|
|
|
2021-03-15 15:30:17 +08:00
|
|
|
import "util.mjs" as Util
|
2021-02-24 16:23:45 +08:00
|
|
|
|
2021-03-15 15:30:17 +08:00
|
|
|
Rectangle {
|
2021-04-07 10:41:34 +08:00
|
|
|
property var wrapper
|
2021-03-19 16:13:02 +08:00
|
|
|
|
2021-04-06 17:07:48 +08:00
|
|
|
clip: true
|
|
|
|
|
2021-03-15 15:30:17 +08:00
|
|
|
property var uuid: Util.uuidv4()
|
2021-03-19 16:13:02 +08:00
|
|
|
|
2021-03-15 15:30:17 +08:00
|
|
|
property var tag: "Stack"
|
|
|
|
|
2021-04-07 10:41:34 +08:00
|
|
|
onWidthChanged: {
|
2021-03-15 15:30:17 +08:00
|
|
|
console.log(tag, uuid + " onWidthChanged: " + this.width)
|
|
|
|
}
|
|
|
|
|
2021-04-07 10:41:34 +08:00
|
|
|
onHeightChanged: {
|
2021-03-15 15:30:17 +08:00
|
|
|
console.log(tag, uuid + " onHeightChanged: " + this.height)
|
|
|
|
}
|
|
|
|
|
|
|
|
color: 'transparent'
|
2021-03-19 16:13:02 +08:00
|
|
|
|
2021-04-08 17:37:10 +08:00
|
|
|
property var backgroundColor
|
|
|
|
|
|
|
|
onBackgroundColorChanged: {
|
|
|
|
color = backgroundColor
|
|
|
|
}
|
|
|
|
|
2021-04-19 14:05:21 +08:00
|
|
|
property var borderWidth: 0
|
|
|
|
onBorderWidthChanged: {
|
|
|
|
border.width = borderWidth
|
|
|
|
}
|
|
|
|
|
|
|
|
property var borderColor: ""
|
|
|
|
onBorderColorChanged: {
|
|
|
|
border.color = borderColor
|
|
|
|
}
|
|
|
|
|
2021-03-19 16:13:02 +08:00
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: {
|
2021-04-07 10:41:34 +08:00
|
|
|
console.log(tag, uuid + " wrapper: " + wrapper)
|
2021-03-19 16:13:02 +08:00
|
|
|
mouseAreaBridge.onClick(wrapper)
|
|
|
|
}
|
|
|
|
}
|
2021-04-27 10:32:42 +08:00
|
|
|
|
|
|
|
property var shadowColor
|
|
|
|
property var shadowRadius
|
|
|
|
property var shadowOffsetX
|
|
|
|
property var shadowOffsetY
|
|
|
|
property var shadowOpacity
|
|
|
|
|
|
|
|
onShadowOpacityChanged: {
|
|
|
|
if (shadowOpacity > 0) {
|
|
|
|
layer.enabled = true
|
|
|
|
} else {
|
|
|
|
layer.enabled = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
layer.enabled: false
|
|
|
|
layer.effect: DropShadow {
|
|
|
|
horizontalOffset: shadowOffsetX
|
|
|
|
verticalOffset: shadowOffsetY
|
|
|
|
radius: shadowRadius
|
|
|
|
samples: 16
|
|
|
|
color: shadowColor
|
|
|
|
transparentBorder: true
|
|
|
|
}
|
2021-02-02 20:42:37 +08:00
|
|
|
}
|