[ui] Viewer2D: add MouseArea on zoom item

* reset zoom to fit image on left click
* right click menu
This commit is contained in:
Fabien Castan 2020-03-05 12:18:29 +01:00
parent 5f2cef7d9d
commit 85dd992927

View file

@ -326,6 +326,22 @@ FocusScope {
Label {
text: ((imgContainer.image && (imgContainer.image.status == Image.Ready)) ? imgContainer.scale.toFixed(2) : "1.00") + "x"
state: "xsmall"
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: {
if(mouse.button & Qt.LeftButton) {
fit()
}
else if(mouse.button & Qt.RightButton) {
var menu = contextMenu.createObject(root);
var point = mapToItem(root, mouse.x, mouse.y)
menu.x = point.x;
menu.y = point.y;
menu.open()
}
}
}
}
MaterialToolButton {
id: displayAlphaBackground