5import QtQuick.Controls as QQC2
8import org.kde.kirigami as Kirigami
16 required property string source
23 required property real sourceWidth
30 required property real sourceHeight
38 required property string tempSource
48 required property string caption
56 readonly property int type: AlbumModelItem.Image
64 property var padding: Kirigami.Units.largeSpacing
69 property var scaleFactor: 1
76 property int rotationAngle: 0
81 signal backgroundClicked()
86 signal itemRightClicked()
108 property var rotationInsensitiveWidth: {
109 if (sourceWidth > 0) {
110 return Math.min(root.sourceWidth, root.width - root.padding * 2);
112 return Math.min(sourceSize.width, root.width - root.padding * 2);
115 property var rotationInsensitiveHeight: {
116 if (sourceHeight > 0) {
117 return Math.min(root.sourceHeight, root.height - root.padding * 2)
119 return Math.min(sourceSize.height, root.height - root.padding * 2)
123 anchors.centerIn: parent
127 width: root.rotationAngle % 180 === 0 ? rotationInsensitiveWidth : rotationInsensitiveHeight
128 height: root.rotationAngle % 180 === 0 ? rotationInsensitiveHeight : rotationInsensitiveWidth
129 fillMode: Image.PreserveAspectFit
133 NumberAnimation {duration:
Kirigami.Units.longDuration; easing.type: Easing.InOutCubic}
136 NumberAnimation {duration:
Kirigami.Units.longDuration; easing.type: Easing.InOutCubic}
141 anchors.centerIn: parent
142 visible: source &&
status === Image.Ready && image.status !== Image.Ready
143 width: root.sourceWidth > 0 || image.sourceSize.width > 0 ? root.sourceWidth : tempImage.sourceSize.width
144 height: root.sourceHeight > 0 || image.sourceSize.height > 0 ? root.sourceHeight : tempImage.sourceSize.height
145 source: root.tempSource
150 origin.x: image.width / 2
151 origin.y: image.height / 2
152 angle: root.rotationAngle
155 RotationAnimation {duration:
Kirigami.Units.longDuration; easing.type: Easing.InOutCubic}
159 origin.x: image.width / 2
160 origin.y: image.height / 2
161 xScale: root.scaleFactor
162 yScale: root.scaleFactor
165 NumberAnimation {duration:
Kirigami.Units.longDuration; easing.type: Easing.InOutCubic}
168 NumberAnimation {duration:
Kirigami.Units.longDuration; easing.type: Easing.InOutCubic}
175 acceptedButtons:
Qt.RightButton
176 onClicked: root.itemRightClicked()
180 anchors.centerIn: parent
181 visible: image.status !== Image.Ready && tempImage.status !== Image.Ready
186 acceptedButtons:
Qt.LeftButton
187 onClicked: root.backgroundClicked()
Q_SCRIPTABLE CaptureState status()