Put HAvatar's tooltip image inside a Loader
Make sure to not load tooltip images unless the user is currently trying to see one by hovering on an avatar. This also seems to reduce idle CPU usage.
This commit is contained in:
parent
8ca8f490fa
commit
dba41c30c2
|
@ -13,13 +13,13 @@ Rectangle {
|
|||
property alias clientUserId: avatarImage.clientUserId
|
||||
property alias mxc: avatarImage.mxc
|
||||
property alias title: avatarImage.title
|
||||
|
||||
property alias toolTipMxc: avatarToolTipImage.mxc
|
||||
property alias sourceOverride: avatarImage.sourceOverride
|
||||
property alias toolTipSourceOverride: avatarToolTipImage.sourceOverride
|
||||
property alias fillMode: avatarImage.fillMode
|
||||
property alias animate: avatarImage.animate
|
||||
|
||||
property string toolTipMxc: mxc
|
||||
property string toolTipSourceOverride: ""
|
||||
|
||||
readonly property alias hovered: hoverHandler.hovered
|
||||
readonly property alias circleRadius: avatarImage.circleRadius
|
||||
|
||||
|
@ -93,13 +93,17 @@ Rectangle {
|
|||
delay: 1000
|
||||
backgroundColor: theme.controls.avatar.hoveredImage.background
|
||||
|
||||
contentItem: HMxcImage {
|
||||
contentItem: HLoader {
|
||||
active: avatarToolTip.visible
|
||||
|
||||
sourceComponent: HMxcImage {
|
||||
id: avatarToolTipImage
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
animatedFillMode: AnimatedImage.PreserveAspectCrop
|
||||
clientUserId: avatarImage.clientUserId
|
||||
mxc: avatarImage.mxc
|
||||
title: avatarImage.title
|
||||
mxc: avatar.toolTipMxc
|
||||
sourceOverride: avatar.toolTipSourceOverride
|
||||
|
||||
sourceSize.width: avatarToolTip.dimension
|
||||
sourceSize.height: avatarToolTip.dimension
|
||||
|
@ -108,4 +112,5 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user