Improve/fix EventImage size handling

This commit is contained in:
miruka
2019-10-27 13:26:00 -04:00
parent bf4517b146
commit 040bfe37f8
3 changed files with 16 additions and 42 deletions

View File

@@ -4,23 +4,13 @@ import "../../utils.js" as Utils
HImage {
id: image
sourceSize.width: theme.chat.message.thumbnailWidth
sourceSize.height: theme.chat.message.thumbnailWidth
width: fitSize.width
height: fitSize.height
// Leaving PreserveAspectFit creates a binding loop, and is uneeded
// since we calculate ourself the right size.
fillMode: Image.Pad
horizontalAlignment: Image.AlignLeft
sourceSize.width: theme.chat.message.thumbnailWidth // FIXME
// source = thumbnail, fullSource = full original image
property url fullSource: source
readonly property size fitSize: Utils.fitSize(
implicitWidth, implicitHeight, theme.chat.message.thumbnailWidth,
)
TapHandler {
onTapped: if (! image.animated) Qt.openUrlExternally(fullSource)