Add avatar tooltips
This commit is contained in:
parent
9af9e88b0d
commit
3dd16ba072
|
@ -2,17 +2,23 @@
|
|||
// This file is part of harmonyqml, licensed under LGPLv3.
|
||||
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.0
|
||||
import "../Base"
|
||||
import "../utils.js" as Utils
|
||||
|
||||
Rectangle {
|
||||
property string name: ""
|
||||
property var imageUrl: null
|
||||
property var toolTipImageUrl: imageUrl
|
||||
property int dimension: theme.avatar.size
|
||||
property bool hidden: false
|
||||
|
||||
onImageUrlChanged: if (imageUrl) { avatarImage.source = imageUrl }
|
||||
|
||||
onToolTipImageUrlChanged: if (imageUrl) {
|
||||
avatarToolTipImage.source = toolTipImageUrl
|
||||
}
|
||||
|
||||
width: dimension
|
||||
height: hidden ? 1 : dimension
|
||||
implicitWidth: dimension
|
||||
|
@ -41,5 +47,22 @@ Rectangle {
|
|||
|
||||
sourceSize.width: dimension
|
||||
sourceSize.height: dimension
|
||||
|
||||
MouseArea {
|
||||
id: imageMouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
}
|
||||
|
||||
ToolTip {
|
||||
visible: imageMouseArea.containsMouse
|
||||
delay: Qt.styleHints.mousePressAndHoldInterval
|
||||
|
||||
HImage {
|
||||
id: avatarToolTipImage
|
||||
sourceSize.width: 128
|
||||
sourceSize.height: 128
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,9 @@ HAvatar {
|
|||
|
||||
imageUrl:
|
||||
roomInfo.avatarUrl ?
|
||||
("image://python/crop/" + roomInfo.avatarUrl) :
|
||||
null
|
||||
("image://python/crop/" + roomInfo.avatarUrl) : null
|
||||
|
||||
toolTipImageUrl:
|
||||
roomInfo.avatarUrl ?
|
||||
("image://python/scale/" + roomInfo.avatarUrl) : null
|
||||
}
|
||||
|
|
|
@ -13,8 +13,11 @@ HAvatar {
|
|||
|
||||
imageUrl:
|
||||
userInfo.avatarUrl ?
|
||||
("image://python/crop/" + userInfo.avatarUrl) :
|
||||
null
|
||||
("image://python/crop/" + userInfo.avatarUrl) : null
|
||||
|
||||
toolTipImageUrl:
|
||||
userInfo.avatarUrl ?
|
||||
("image://python/scale/" + userInfo.avatarUrl) : null
|
||||
|
||||
//HImage {
|
||||
//id: status
|
||||
|
|
Loading…
Reference in New Issue
Block a user