Skip to content
Snippets Groups Projects
Commit 3aa63b60 authored by Fatih Uzunoğlu's avatar Fatih Uzunoğlu Committed by Pierre Lamot
Browse files

qml: fix SortControl background effect rendering


Signed-off-by: default avatarPierre Lamot <pierre@videolabs.io>
parent dc8f9ff0
No related branches found
No related tags found
No related merge requests found
......@@ -104,8 +104,6 @@ Widgets.NavigableFocusScope {
padding: 1
onOpened: {
updateBgRect()
button.KeyNavigation.down = list
button.highlighted = true
......@@ -228,58 +226,60 @@ Widgets.NavigableFocusScope {
}
}
function updateBgRect() {
glassEffect.popupGlobalPos = g_root.mapFromItem(root, popup.x, popup.y)
}
background: Rectangle {
border.width: VLCStyle.dp(1)
border.color: colors.accent
Widgets.FrostedGlassEffect {
id: glassEffect
source: g_root
Loader {
id: effectLoader
anchors.fill: parent
anchors.margins: VLCStyle.dp(1)
property point popupGlobalPos
sourceRect: Qt.rect(popupGlobalPos.x, popupGlobalPos.y, glassEffect.width, glassEffect.height)
asynchronous: true
tint: colors.bg
tintStrength: 0.3
}
}
Component {
id: frostedGlassEffect
Connections {
target: g_root
Widgets.FrostedGlassEffect {
source: g_root
enabled: popup.visible
// since Popup is not an Item, we can not directly map its position
// to the source item. Instead, we can use root because popup's
// position is relative to its position.
// This method unfortunately causes issues when source item is resized.
// But in that case, we reload the effectLoader to redraw the effect.
property point popupMappedPos: g_root.mapFromItem(root, popup.x, popup.y)
sourceRect: Qt.rect(popupMappedPos.x, popupMappedPos.y, width, height)
onWidthChanged: {
popup.updateBgRect()
}
tint: colors.bg
tintStrength: 0.3
}
}
onHeightChanged: {
popup.updateBgRect()
sourceComponent: frostedGlassEffect
function reload() {
if (status != Loader.Ready)
return
sourceComponent = undefined
sourceComponent = frostedGlassEffect
}
}
}
Connections {
target: mainInterface
target: g_root
enabled: popup.visible
onIntfScaleFactorChanged: {
popup.updateBgRect()
onWidthChanged: {
effectLoader.reload()
}
}
Connections {
target: playlistColumn
onWidthChanged: {
popup.updateBgRect()
onHeightChanged: {
effectLoader.reload()
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment