controlcenter: fix wallpaper gradient overlay

This commit is contained in:
2 * r + 2 * t 2025-11-15 17:43:03 +11:00
parent 56ed76e183
commit 266cffe342

View file

@ -48,15 +48,24 @@ RowLayout {
spacing: 0 spacing: 0
function collapseAllSections(exceptSection) { function collapseAllSections(exceptSection) {
if (exceptSection !== themeModeSection) themeModeSection.expanded = false; if (exceptSection !== themeModeSection)
if (exceptSection !== colorVariantSection) colorVariantSection.expanded = false; themeModeSection.expanded = false;
if (exceptSection !== colorSchemeSection) colorSchemeSection.expanded = false; if (exceptSection !== colorVariantSection)
if (exceptSection !== animationsSection) animationsSection.expanded = false; colorVariantSection.expanded = false;
if (exceptSection !== fontsSection) fontsSection.expanded = false; if (exceptSection !== colorSchemeSection)
if (exceptSection !== scalesSection) scalesSection.expanded = false; colorSchemeSection.expanded = false;
if (exceptSection !== transparencySection) transparencySection.expanded = false; if (exceptSection !== animationsSection)
if (exceptSection !== borderSection) borderSection.expanded = false; animationsSection.expanded = false;
if (exceptSection !== backgroundSection) backgroundSection.expanded = false; if (exceptSection !== fontsSection)
fontsSection.expanded = false;
if (exceptSection !== scalesSection)
scalesSection.expanded = false;
if (exceptSection !== transparencySection)
transparencySection.expanded = false;
if (exceptSection !== borderSection)
borderSection.expanded = false;
if (exceptSection !== backgroundSection)
backgroundSection.expanded = false;
} }
function saveConfig() { function saveConfig() {
@ -948,10 +957,7 @@ RowLayout {
anchors.fill: parent anchors.fill: parent
// Ensure sourceSize is always set to valid dimensions // Ensure sourceSize is always set to valid dimensions
sourceSize: Qt.size( sourceSize: Qt.size(Math.max(1, Math.floor(parent.width)), Math.max(1, Math.floor(parent.height)))
Math.max(1, Math.floor(parent.width)),
Math.max(1, Math.floor(parent.height))
)
// Show when ready, hide if fallback is showing // Show when ready, hide if fallback is showing
opacity: status === Image.Ready && !fallbackImage.visible ? 1 : 0 opacity: status === Image.Ready && !fallbackImage.visible ? 1 : 0
@ -971,10 +977,7 @@ RowLayout {
source: modelData.path source: modelData.path
asynchronous: true asynchronous: true
fillMode: Image.PreserveAspectCrop fillMode: Image.PreserveAspectCrop
sourceSize: Qt.size( sourceSize: Qt.size(Math.max(1, Math.floor(parent.width)), Math.max(1, Math.floor(parent.height)))
Math.max(1, Math.floor(parent.width)),
Math.max(1, Math.floor(parent.height))
)
// Show if caching image hasn't loaded after a delay // Show if caching image hasn't loaded after a delay
visible: opacity > 0 visible: opacity > 0
@ -1019,24 +1022,35 @@ RowLayout {
color: Colours.palette.m3primary color: Colours.palette.m3primary
font.pointSize: Appearance.font.size.large font.pointSize: Appearance.font.size.large
} }
}
// Gradient overlay for filename with rounded bottom corners // Gradient overlay for filename with rounded bottom corners
Rectangle { Rectangle {
id: filenameOverlay id: filenameOverlay
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
height: filenameText.implicitHeight + Appearance.padding.normal * 2
// Match the parent's rounded corners at the bottom implicitHeight: filenameText.implicitHeight + Appearance.padding.normal * 2
radius: Appearance.rounding.normal
gradient: Gradient { gradient: Gradient {
GradientStop { position: 0.0; color: Qt.rgba(0, 0, 0, 0) } GradientStop {
GradientStop { position: 0.3; color: Qt.rgba(0, 0, 0, 0.3) } position: 0.0
GradientStop { position: 0.7; color: Qt.rgba(0, 0, 0, 0.75) } color: Qt.rgba(0, 0, 0, 0)
GradientStop { position: 1.0; color: Qt.rgba(0, 0, 0, 0.85) } }
GradientStop {
position: 0.3
color: Qt.rgba(0, 0, 0, 0.3)
}
GradientStop {
position: 0.7
color: Qt.rgba(0, 0, 0, 0.75)
}
GradientStop {
position: 1.0
color: Qt.rgba(0, 0, 0, 0.85)
}
}
} }
opacity: 0 opacity: 0
@ -1075,10 +1089,6 @@ RowLayout {
elide: Text.ElideMiddle elide: Text.ElideMiddle
maximumLineCount: 1 maximumLineCount: 1
// Text shadow for better readability
style: Text.Outline
styleColor: Qt.rgba(0, 0, 0, 0.6)
opacity: 0 opacity: 0
Behavior on opacity { Behavior on opacity {
@ -1103,5 +1113,3 @@ RowLayout {
} }
} }
} }