2020-09-29 09:06:57 +00:00
|
|
|
import QtQuick 2.13
|
2020-11-12 14:33:18 +00:00
|
|
|
import QtGraphicalEffects 1.13
|
2020-09-29 09:06:57 +00:00
|
|
|
import QtQuick.Controls 2.13
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared 1.0
|
2023-09-26 14:16:53 +00:00
|
|
|
import shared.controls.chat 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared.panels 1.0
|
2020-09-29 09:06:57 +00:00
|
|
|
|
2021-03-10 04:59:01 +00:00
|
|
|
Row {
|
2020-09-29 09:06:57 +00:00
|
|
|
id: imageArea
|
2023-09-26 14:16:53 +00:00
|
|
|
spacing: Style.current.halfPadding
|
2020-09-29 09:06:57 +00:00
|
|
|
|
2021-03-10 04:59:01 +00:00
|
|
|
signal imageRemoved(int index)
|
2022-02-01 13:10:24 +00:00
|
|
|
signal imageClicked(var chatImage)
|
2023-09-26 14:16:53 +00:00
|
|
|
|
|
|
|
property bool leftTail: true
|
|
|
|
|
2021-03-10 04:59:01 +00:00
|
|
|
property alias imageSource: rptImages.model
|
|
|
|
|
|
|
|
Repeater {
|
|
|
|
id: rptImages
|
2023-09-26 14:16:53 +00:00
|
|
|
|
2021-03-10 04:59:01 +00:00
|
|
|
Item {
|
2023-09-26 14:16:53 +00:00
|
|
|
height: chatImage.height
|
|
|
|
width: chatImage.width
|
2021-07-13 07:34:13 +00:00
|
|
|
|
2021-03-10 04:59:01 +00:00
|
|
|
Image {
|
|
|
|
id: chatImage
|
2021-07-13 07:34:13 +00:00
|
|
|
anchors.left: parent.left
|
2023-09-26 14:16:53 +00:00
|
|
|
anchors.bottom: parent.bottom
|
2021-03-10 04:59:01 +00:00
|
|
|
width: 64
|
|
|
|
height: 64
|
|
|
|
fillMode: Image.PreserveAspectCrop
|
|
|
|
mipmap: true
|
|
|
|
smooth: false
|
|
|
|
antialiasing: true
|
2023-04-26 15:33:24 +00:00
|
|
|
cache: false
|
2021-03-10 04:59:01 +00:00
|
|
|
source: modelData
|
|
|
|
layer.enabled: true
|
2023-09-26 14:16:53 +00:00
|
|
|
layer.effect: CalloutOpacityMask {
|
|
|
|
width: parent.width
|
|
|
|
height: parent.height
|
|
|
|
leftTail: imageArea.leftTail
|
2021-03-10 04:59:01 +00:00
|
|
|
}
|
|
|
|
}
|
2021-07-13 07:34:13 +00:00
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
id: mouseArea
|
|
|
|
anchors.fill: parent
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
hoverEnabled: true
|
2022-02-01 13:10:24 +00:00
|
|
|
onClicked: imageClicked(chatImage)
|
2021-07-13 07:34:13 +00:00
|
|
|
}
|
|
|
|
|
2021-03-10 04:59:01 +00:00
|
|
|
RoundButton {
|
|
|
|
id: closeBtn
|
2021-07-13 07:34:13 +00:00
|
|
|
width: 24
|
|
|
|
height: 24
|
2021-03-10 04:59:01 +00:00
|
|
|
padding: 0
|
|
|
|
anchors.right: chatImage.right
|
2021-07-13 07:34:13 +00:00
|
|
|
anchors.rightMargin: -width / 3
|
|
|
|
anchors.top: chatImage.top
|
|
|
|
anchors.topMargin: -height / 3
|
|
|
|
hoverEnabled: false
|
|
|
|
opacity: mouseArea.containsMouse || buttonMouseArea.containsMouse ? 1 : 0
|
2021-03-10 04:59:01 +00:00
|
|
|
contentItem: SVGImage {
|
2021-09-28 15:04:06 +00:00
|
|
|
source: Style.svg( !buttonMouseArea.containsMouse ? "close-filled" : "close-filled-hovered")
|
2021-03-10 04:59:01 +00:00
|
|
|
width: closeBtn.width
|
|
|
|
height: closeBtn.height
|
|
|
|
}
|
|
|
|
background: Rectangle {
|
|
|
|
color: "transparent"
|
|
|
|
}
|
|
|
|
onClicked: {
|
|
|
|
imageArea.imageRemoved(index)
|
2020-11-12 14:33:18 +00:00
|
|
|
}
|
2021-03-10 04:59:01 +00:00
|
|
|
MouseArea {
|
2021-07-13 07:34:13 +00:00
|
|
|
id: buttonMouseArea
|
2021-03-10 04:59:01 +00:00
|
|
|
anchors.fill: parent
|
2021-07-13 07:34:13 +00:00
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
hoverEnabled: true
|
|
|
|
onClicked: closeBtn.clicked()
|
2020-11-12 14:33:18 +00:00
|
|
|
}
|
2020-09-29 09:06:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|