summary refs log tree commit diff
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2020-10-16 12:44:45 +0200
committerGitHub <noreply@github.com>2020-10-16 12:44:45 +0200
commitb23913fa7c448debb57d214ebee02ba866451beb (patch)
tree25f5c2cb5565a67d7b4cf6275f86c31d5a7d3e5f
parentTranslated using Weblate (Estonian) (diff)
parentMake Text element a sibling of the Rectangle to avoid the text from depending... (diff)
downloadnheko-b23913fa7c448debb57d214ebee02ba866451beb.tar.xz
Merge pull request #301 from kamathmanu/issue266-filenameOnHover
Display filename on mouse hover
-rw-r--r--resources/qml/delegates/ImageMessage.qml31
1 files changed, 30 insertions, 1 deletions
diff --git a/resources/qml/delegates/ImageMessage.qml b/resources/qml/delegates/ImageMessage.qml

index e2c78fbe..6ac5ee15 100644 --- a/resources/qml/delegates/ImageMessage.qml +++ b/resources/qml/delegates/ImageMessage.qml
@@ -31,11 +31,40 @@ Item { fillMode: Image.PreserveAspectFit MouseArea { + id: mouseArea enabled: model.data.type == MtxEvent.ImageMessage && img.status == Image.Ready + hoverEnabled: true anchors.fill: parent onClicked: TimelineManager.openImageOverlay(model.data.url, model.data.id) } - } + Item { + id: overlay + + anchors.fill: parent + visible: mouseArea.containsMouse + + Rectangle { + id: container + + width: parent.width + implicitHeight: imgcaption.implicitHeight + anchors.bottom: overlay.bottom + color: colors.window + opacity: 0.75 + } + Text { + id: imgcaption + + anchors.fill: container + elide: Text.ElideMiddle + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + // See this MSC: https://github.com/matrix-org/matrix-doc/pull/2530 + text: model.data.filename ? model.data.filename : model.data.body + color: colors.text + } + } + } }