moment/src/qml/Chat/Timeline/EventImage.qml

36 lines
863 B
QML
Raw Normal View History

import QtQuick 2.12
import "../../Base"
HImage {
id: image
sourceSize.width: theme.chat.message.thumbnailWidth
sourceSize.height: theme.chat.message.thumbnailWidth
width: Math.min(
mainColumn.width - eventContent.spacing * 2,
implicitWidth,
theme.chat.message.thumbnailWidth,
)
// source = thumbnail, fullSource = full original image
property url fullSource: source
TapHandler {
onTapped: if (! image.animated) Qt.openUrlExternally(image.fullSource)
onDoubleTapped: Qt.openUrlExternally(image.fullSource)
}
HoverHandler {
id: hover
2019-09-07 07:21:41 +10:00
onHoveredChanged:
eventContent.hoveredImage = hovered ? image.fullSource : ""
}
MouseArea {
anchors.fill: image
acceptedButtons: Qt.NoButton
cursorShape: Qt.PointingHandCursor
}
}