Use a component to display image link previews

This commit is contained in:
miruka
2019-09-03 03:04:57 -04:00
parent 3c4ca7d433
commit 5674d0c7b7
10 changed files with 147 additions and 100 deletions

View File

@@ -0,0 +1,31 @@
import QtQuick 2.12
import "../../Base"
HImage {
id: image
x: eventContent.spacing
sourceSize.width: maxDimension
sourceSize.height: maxDimension
width: Math.min(
mainColumn.width - eventContent.spacing * 2,
implicitWidth,
maxDimension,
)
property int maxDimension: window.settings.messageImageMaxThumbnailSize
TapHandler {
onTapped: Qt.openUrlExternally(image.source)
}
HoverHandler {
id: hover
onHoveredChanged: eventDelegate.hoveredImage = hovered ? image.source : ""
}
MouseArea {
anchors.fill: image
acceptedButtons: Qt.NoButton
cursorShape: Qt.PointingHandCursor
}
}