mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-28 13:21:10 -07:00
Masking is not avaliable after the QT6 upgrade, this does a kind of primitive masking by placing a rectangle with a circular hole in it over the image.
CURA-9104
This commit is contained in:
parent
d1d45b4f41
commit
94e5a4e1db
5 changed files with 27 additions and 20 deletions
|
|
@ -15,43 +15,44 @@ Item
|
|||
|
||||
property alias source: profileImage.source
|
||||
property alias outlineColor: profileImageOutline.color
|
||||
|
||||
// This should be set to the color behind the image
|
||||
// It fills the space around a rectangular avatar to make the image under it look circular
|
||||
property alias maskColor: profileImageMask.color
|
||||
property bool hasAvatar: source != ""
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: profileImageBackground
|
||||
anchors.fill: parent
|
||||
radius: width
|
||||
color: "white"
|
||||
}
|
||||
|
||||
Image
|
||||
{
|
||||
id: profileImage
|
||||
anchors.fill: parent
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
visible: false
|
||||
visible: hasAvatar
|
||||
mipmap: true
|
||||
}
|
||||
|
||||
Rectangle
|
||||
UM.ColorImage
|
||||
{
|
||||
// This image is a rectangle with a hole in the middle.
|
||||
// Since we don't have access to proper masking in QT6 yet this is used as a primitive masking replacement
|
||||
id: profileImageMask
|
||||
anchors.fill: parent
|
||||
radius: width
|
||||
color: hasAvatar ? "white" : "transparent"
|
||||
source: UM.Theme.getIcon("CircleMask")
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: Reimplement this without OpacityMask.
|
||||
OpacityMask
|
||||
{
|
||||
anchors.fill: parent
|
||||
source: profileImage
|
||||
maskSource: profileImageMask
|
||||
visible: hasAvatar
|
||||
cached: true
|
||||
}*/
|
||||
|
||||
UM.ColorImage
|
||||
{
|
||||
// This creates the circle outline around the image
|
||||
id: profileImageOutline
|
||||
anchors.centerIn: parent
|
||||
// Make it a bit bigger than it has to, otherwise it sometimes shows a white border.
|
||||
width: parent.width + 2
|
||||
height: parent.height + 2
|
||||
anchors.fill: parent
|
||||
anchors.margins: .25
|
||||
visible: hasAvatar
|
||||
source: UM.Theme.getIcon("CircleOutline")
|
||||
color: UM.Theme.getColor("account_widget_outline_active")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue