// SPDX-License-Identifier: GPL-2.0-only // Copyright (C) 2026 Danilo M. // // A frosted panel. It snapshots the wallpaper image the panel sits on, blurs it // and masks it to the panel's rounded rect, then tints it for text contrast. // When there is no source, only the tint draws, so the panel still reads. import QtQuick import QtQuick.Effects Item { id: backdrop property Item sourceItem: null property int radius: 10 property color tint: "#24273a" property real tintOpacity: 0.72 property bool blurEnabled: true ShaderEffectSource { id: snapshot sourceItem: backdrop.sourceItem live: true sourceRect: { if (backdrop.sourceItem === null) return Qt.rect(0, 0, 0, 0) // Guard reads: mapToItem() hides its reads in C++, so the binding // would not otherwise re-run when the panel or image moves (e.g. // the failed-login shake). Reading the coordinates registers them. var _guard = backdrop.x + backdrop.y + backdrop.parent.x + backdrop.parent.y + backdrop.sourceItem.x + backdrop.sourceItem.y var p = backdrop.mapToItem(backdrop.sourceItem, 0, 0) return Qt.rect(p.x, p.y, backdrop.width, backdrop.height) } } MultiEffect { anchors.fill: parent source: snapshot visible: backdrop.sourceItem !== null && backdrop.blurEnabled blurEnabled: true blur: 1.0 blurMax: 288 maskEnabled: true maskSource: mask } Rectangle { id: mask anchors.fill: parent radius: backdrop.radius layer.enabled: true visible: false } Rectangle { anchors.fill: parent radius: backdrop.radius color: backdrop.tint opacity: backdrop.tintOpacity } }