fix(ui): soften text shadow rendering
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Effects
|
||||||
import org.kde.plasma.components as PlasmaComponents
|
import org.kde.plasma.components as PlasmaComponents
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@@ -12,31 +13,49 @@ Item {
|
|||||||
property alias verticalAlignment: foregroundLabel.verticalAlignment
|
property alias verticalAlignment: foregroundLabel.verticalAlignment
|
||||||
property alias color: foregroundLabel.color
|
property alias color: foregroundLabel.color
|
||||||
property bool shadowEnabled: false
|
property bool shadowEnabled: false
|
||||||
|
readonly property real contentWidth: width > 0 ? width : foregroundLabel.implicitWidth
|
||||||
|
readonly property real contentHeight: height > 0 ? height : foregroundLabel.implicitHeight
|
||||||
|
|
||||||
implicitWidth: foregroundLabel.implicitWidth + (shadowEnabled ? 1 : 0)
|
implicitWidth: foregroundLabel.implicitWidth
|
||||||
implicitHeight: foregroundLabel.implicitHeight + (shadowEnabled ? 1 : 0)
|
implicitHeight: foregroundLabel.implicitHeight
|
||||||
|
|
||||||
PlasmaComponents.Label {
|
PlasmaComponents.Label {
|
||||||
id: shadowLabel
|
id: shadowSourceLabel
|
||||||
|
|
||||||
visible: shadowedLabel.shadowEnabled
|
visible: false
|
||||||
x: 1
|
width: shadowedLabel.contentWidth
|
||||||
y: 1
|
height: shadowedLabel.contentHeight
|
||||||
width: foregroundLabel.width
|
|
||||||
height: foregroundLabel.height
|
|
||||||
text: foregroundLabel.text
|
text: foregroundLabel.text
|
||||||
font: foregroundLabel.font
|
font: foregroundLabel.font
|
||||||
lineHeight: foregroundLabel.lineHeight
|
lineHeight: foregroundLabel.lineHeight
|
||||||
elide: foregroundLabel.elide
|
elide: foregroundLabel.elide
|
||||||
horizontalAlignment: foregroundLabel.horizontalAlignment
|
horizontalAlignment: foregroundLabel.horizontalAlignment
|
||||||
verticalAlignment: foregroundLabel.verticalAlignment
|
verticalAlignment: foregroundLabel.verticalAlignment
|
||||||
color: "#99000000"
|
color: "white"
|
||||||
|
}
|
||||||
|
|
||||||
|
MultiEffect {
|
||||||
|
x: shadowSourceLabel.x
|
||||||
|
y: shadowSourceLabel.y
|
||||||
|
width: shadowSourceLabel.width
|
||||||
|
height: shadowSourceLabel.height
|
||||||
|
autoPaddingEnabled: true
|
||||||
|
shadowBlur: 0.5
|
||||||
|
shadowColor: "#3f4c66"
|
||||||
|
shadowEnabled: shadowedLabel.shadowEnabled
|
||||||
|
shadowHorizontalOffset: 0
|
||||||
|
shadowOpacity: 0.42
|
||||||
|
shadowScale: 1
|
||||||
|
shadowVerticalOffset: 2
|
||||||
|
source: shadowSourceLabel
|
||||||
|
visible: shadowedLabel.shadowEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
PlasmaComponents.Label {
|
PlasmaComponents.Label {
|
||||||
id: foregroundLabel
|
id: foregroundLabel
|
||||||
|
|
||||||
anchors.fill: parent
|
width: shadowedLabel.contentWidth
|
||||||
|
height: shadowedLabel.contentHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user