mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-05 23:04:30 +08:00

For some reason qt6 that we built still didn't like it. Since we wanna know if the rest works, yeeting that stuff out for now
61 lines
1.5 KiB
QML
61 lines
1.5 KiB
QML
// Copyright (c) 2018 Ultimaker B.V.
|
|
// Cura is released under the terms of the LGPLv3 or higher.
|
|
|
|
import QtQuick 2.10
|
|
import QtQuick.Controls 2.3
|
|
|
|
import UM 1.4 as UM
|
|
|
|
Item
|
|
{
|
|
// This item shows the provided image while applying a round mask to it.
|
|
// It also shows a round border around it. The color is defined by the outlineColor property.
|
|
|
|
id: avatar
|
|
|
|
property alias source: profileImage.source
|
|
property alias outlineColor: profileImageOutline.color
|
|
property bool hasAvatar: source != ""
|
|
|
|
Image
|
|
{
|
|
id: profileImage
|
|
anchors.fill: parent
|
|
fillMode: Image.PreserveAspectCrop
|
|
visible: false
|
|
mipmap: true
|
|
}
|
|
|
|
Rectangle
|
|
{
|
|
id: profileImageMask
|
|
anchors.fill: parent
|
|
radius: width
|
|
color: hasAvatar ? "white" : "transparent"
|
|
}
|
|
|
|
/*
|
|
TODO: Reimplement this without OpacityMask.
|
|
OpacityMask
|
|
{
|
|
anchors.fill: parent
|
|
source: profileImage
|
|
maskSource: profileImageMask
|
|
visible: hasAvatar
|
|
cached: true
|
|
}*/
|
|
|
|
UM.RecolorImage
|
|
{
|
|
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
|
|
visible: hasAvatar
|
|
source: UM.Theme.getIcon("CircleOutline")
|
|
sourceSize: Qt.size(parent.width, parent.height)
|
|
color: UM.Theme.getColor("account_widget_outline_active")
|
|
}
|
|
}
|