RibbonBlur: Add solid bg property.

This commit is contained in:
Mentalflow 2024-03-30 18:32:51 +08:00
parent b0ab35c7b9
commit 326fbdeeb8
Signed by: Mentalflow
GPG Key ID: 5AE68D4401A2EE71
2 changed files with 15 additions and 13 deletions

View File

@ -8,9 +8,10 @@ Item {
property int blur_radius: 32 property int blur_radius: 32
property alias target: effect.sourceItem property alias target: effect.sourceItem
property rect target_rect : Qt.rect(control.x, control.y, control.width, control.height) property rect target_rect : Qt.rect(control.x, control.y, control.width, control.height)
property color mask_color: RibbonTheme.dark_mode ? "#212629" : "white" property color mask_color: RibbonTheme.dark_mode ? RibbonTheme.modern_style ? '#292929' : "#212629" : "white"
property double mask_opacity: 0.5 property double mask_opacity: 0.5
property alias mask_border: mask.border property alias mask_border: mask.border
property bool use_solid_bg: true
ShaderEffectSource { ShaderEffectSource {
id: effect id: effect
@ -18,10 +19,6 @@ Item {
sourceRect: target_rect sourceRect: target_rect
sourceItem: target sourceItem: target
visible: false visible: false
Rectangle{
radius: control.radius
visible: false
}
} }
GaussianBlur{ GaussianBlur{
@ -34,13 +31,18 @@ Item {
visible: false visible: false
} }
OpacityMask { Rectangle{
anchors.fill: parent anchors.fill: parent
source: blur color: use_solid_bg ? mask_color : 'transparent'
maskSource: Rectangle{ radius: control.radius
width: control.width OpacityMask {
height: control.height anchors.fill: parent
radius: control.radius source: blur
maskSource: Rectangle{
width: control.width
height: control.height
radius: control.radius
}
} }
} }
@ -51,6 +53,4 @@ Item {
opacity: mask_opacity opacity: mask_opacity
radius: control.radius radius: control.radius
} }
} }

View File

@ -39,6 +39,7 @@ Item {
visible: top_padding visible: top_padding
clip: true clip: true
target_rect: Qt.rect(x,y-top_padding,width,height) target_rect: Qt.rect(x,y-top_padding,width,height)
use_solid_bg: false
} }
Item{ Item{
@ -72,5 +73,6 @@ Item {
visible: bottom_padding visible: bottom_padding
clip: true clip: true
target_rect: Qt.rect(x,y-top_padding,width,height) target_rect: Qt.rect(x,y-top_padding,width,height)
use_solid_bg: false
} }
} }