Change AvatarImage so it uses aliases instead of properties

I've changed this because it makes for much cleaner QML

CURA-5772
This commit is contained in:
Jaime van Kessel 2018-10-15 13:41:44 +02:00
parent d2baef97c4
commit 0a1dad92ea

View File

@ -7,19 +7,19 @@ import UM 1.4 as UM
Item 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 id: avatar
property var source property alias source: profileImage.source
property var fallbackSource: UM.Theme.getImage("avatar_default") property alias outlineColor: profileImageOutline.color
property var outlineColor: UM.Theme.getColor("account_widget_ouline_active")
Image Image
{ {
id: profileImage id: profileImage
source: avatar.source ? avatar.source : UM.Theme.getImage("avatar_default") source: UM.Theme.getImage("avatar_default")
sourceSize: Qt.size(parent.width, parent.height) anchors.fill: parent
width: parent.width
height: parent.height
fillMode: Image.PreserveAspectCrop fillMode: Image.PreserveAspectCrop
visible: false visible: false
} }
@ -29,8 +29,7 @@ Item
id: profileImageMask id: profileImageMask
source: UM.Theme.getIcon("circle_mask") source: UM.Theme.getIcon("circle_mask")
sourceSize: Qt.size(parent.width, parent.height) sourceSize: Qt.size(parent.width, parent.height)
width: parent.width anchors.fill: parent
height: parent.height
color: UM.Theme.getColor("topheader_background") color: UM.Theme.getColor("topheader_background")
visible: false visible: false
} }
@ -49,8 +48,7 @@ Item
id: profileImageOutline id: profileImageOutline
source: UM.Theme.getIcon("circle_outline") source: UM.Theme.getIcon("circle_outline")
sourceSize: Qt.size(parent.width, parent.height) sourceSize: Qt.size(parent.width, parent.height)
width: parent.width anchors.fill: parent
height: parent.height color: UM.Theme.getColor("account_widget_ouline_active")
color: avatar.outlineColor
} }
} }