mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 13:08:48 +03:00
Display filename on mouse hover
This commit is contained in:
parent
716992b761
commit
a0c2a174ea
1 changed files with 30 additions and 1 deletions
|
@ -31,11 +31,40 @@ Item {
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
id: mouseArea
|
||||||
enabled: model.data.type == MtxEvent.ImageMessage && img.status == Image.Ready
|
enabled: model.data.type == MtxEvent.ImageMessage && img.status == Image.Ready
|
||||||
|
hoverEnabled: true
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: TimelineManager.openImageOverlay(model.data.url, model.data.id)
|
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: "black"
|
||||||
|
opacity: 0.75
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: imgcaption
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
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
|
||||||
|
font.pointSize: 11
|
||||||
|
color: "white"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue