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,18 +93,23 @@ Rectangle {
|
|||
delay: 1000
|
||||
backgroundColor: theme.controls.avatar.hoveredImage.background
|
||||
|
||||
contentItem: HMxcImage {
|
||||
id: avatarToolTipImage
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
animatedFillMode: AnimatedImage.PreserveAspectCrop
|
||||
clientUserId: avatarImage.clientUserId
|
||||
mxc: avatarImage.mxc
|
||||
title: avatarImage.title
|
||||
contentItem: HLoader {
|
||||
active: avatarToolTip.visible
|
||||
|
||||
sourceSize.width: avatarToolTip.dimension
|
||||
sourceSize.height: avatarToolTip.dimension
|
||||
width: avatarToolTip.dimension
|
||||
height: avatarToolTip.dimension
|
||||
sourceComponent: HMxcImage {
|
||||
id: avatarToolTipImage
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
animatedFillMode: AnimatedImage.PreserveAspectCrop
|
||||
clientUserId: avatarImage.clientUserId
|
||||
title: avatarImage.title
|
||||
mxc: avatar.toolTipMxc
|
||||
sourceOverride: avatar.toolTipSourceOverride
|
||||
|
||||
sourceSize.width: avatarToolTip.dimension
|
||||
sourceSize.height: avatarToolTip.dimension
|
||||
width: avatarToolTip.dimension
|
||||
height: avatarToolTip.dimension
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user