This commit is contained in:
zhuzihcu
2023-03-27 18:24:35 +08:00
parent a2c23231f2
commit 3a32d66d6a
40 changed files with 562 additions and 269 deletions

View File

@ -3,7 +3,7 @@ import QtQuick.Controls 2.15
import QtGraphicalEffects 1.15
Item{
id:root
id:control
property var radius:[0,0,0,0]
property color color : "#FFFFFF"
property bool shadow: true
@ -11,17 +11,17 @@ Item{
Rectangle{
id:container
width: root.width
height: root.height
width: control.width
height: control.height
opacity: 0
color:root.color
color:control.color
}
FluShadow{
anchors.fill: container
radius: root.radius[0]
radius: control.radius[0]
visible: {
if(root.radius[0] === root.radius[1] && root.radius[0] === root.radius[2] && root.radius[0] === root.radius[3] && root.shadow){
if(control.radius[0] === control.radius[1] && control.radius[0] === control.radius[2] && control.radius[0] === control.radius[3] && control.shadow){
return true
}
return false
@ -36,8 +36,8 @@ Item{
var ctx = getContext("2d");
var x = 0;
var y = 0;
var w = root.width;
var h = root.height;
var w = control.width;
var h = control.height;
ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.save();
@ -52,7 +52,7 @@ Item{
ctx.lineTo(x, y + radius[0]);
ctx.arcTo(x, y, x + radius[0], y, radius[0]);
ctx.closePath();
ctx.fillStyle = root.color;
ctx.fillStyle = control.color;
ctx.fill();
ctx.restore();
}