Make avatar images rounded
This commit is contained in:
parent
81382b213c
commit
54b2673f9a
3 changed files with 24 additions and 33 deletions
|
|
@ -35,18 +35,13 @@ Item {
|
|||
spacing: Style.marginMedium * scaling
|
||||
|
||||
// Avatar preview
|
||||
Rectangle {
|
||||
NImageRounded {
|
||||
width: 64 * scaling
|
||||
height: 64 * scaling
|
||||
radius: width * 0.5
|
||||
color: Colors.accentPrimary
|
||||
border.color: Colors.outline
|
||||
border.width: Math.max(1, Style.borderThin * scaling)
|
||||
|
||||
NImageRounded {
|
||||
imagePath: Settings.data.general.avatarImage
|
||||
fallbackIcon: "person"
|
||||
}
|
||||
borderColor: Colors.accentPrimary
|
||||
borderWidth: Math.max(1, Style.borderMedium * scaling)
|
||||
}
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
|
|
|
|||
|
|
@ -25,30 +25,13 @@ NBox {
|
|||
anchors.margins: Style.marginMedium * scaling
|
||||
spacing: Style.marginMedium * scaling
|
||||
|
||||
Item {
|
||||
id: avatarBox
|
||||
NImageRounded {
|
||||
width: Style.baseWidgetSize * 1.25 * scaling
|
||||
height: Style.baseWidgetSize * 1.25 * scaling
|
||||
|
||||
Image {
|
||||
id: avatarImage
|
||||
anchors.fill: parent
|
||||
source: Settings.data.general.avatarImage
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
asynchronous: true
|
||||
}
|
||||
|
||||
// Ensure rounded corners consistently across renderers
|
||||
MultiEffect {
|
||||
anchors.fill: avatarImage
|
||||
source: avatarImage
|
||||
maskEnabled: true
|
||||
maskSource: Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "white"
|
||||
radius: Style.radiusMedium * scaling
|
||||
}
|
||||
}
|
||||
imagePath: Settings.data.general.avatarImage
|
||||
fallbackIcon: "person"
|
||||
borderColor: Colors.accentPrimary
|
||||
borderWidth: Math.max(1, Style.borderMedium * scaling)
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
|
|
|
|||
|
|
@ -5,14 +5,27 @@ import Quickshell.Widgets
|
|||
import qs.Services
|
||||
|
||||
Rectangle {
|
||||
color: "transparent"
|
||||
radius: width * 0.5
|
||||
|
||||
readonly property real scaling: Scaling.scale(screen)
|
||||
property string imagePath: ""
|
||||
property string fallbackIcon: ""
|
||||
property color borderColor: "transparent"
|
||||
property real borderWidth: 0
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.margins: Style.marginTiniest * scaling
|
||||
|
||||
// Border
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: parent.radius
|
||||
color: "transparent"
|
||||
border.color: parent.borderColor
|
||||
border.width: parent.borderWidth
|
||||
z: 10
|
||||
}
|
||||
|
||||
Image {
|
||||
id: img
|
||||
anchors.fill: parent
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue