mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-04 01:08:26 +02:00
[ui] ImageGallery: add contextual menu + readOnly mode
* contextMenu: open image containing folder / remove image * readOnly: disable image removing when graph is being computed
This commit is contained in:
parent
f6a1ee23d2
commit
fccaa9d186
2 changed files with 33 additions and 4 deletions
|
@ -7,16 +7,23 @@ import "Viewer" 1.0
|
|||
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property alias model: grid.model
|
||||
property bool readOnly: false
|
||||
implicitWidth: 300
|
||||
implicitHeight: 400
|
||||
|
||||
clip: true
|
||||
signal removeImageRequest(var attribute)
|
||||
|
||||
SystemPalette {
|
||||
id: palette
|
||||
}
|
||||
|
||||
function dirname(filename) {
|
||||
return filename.substring(0, filename.lastIndexOf('/'))
|
||||
}
|
||||
|
||||
Controls1.SplitView {
|
||||
anchors.fill: parent
|
||||
GridView {
|
||||
|
@ -32,7 +39,8 @@ Item {
|
|||
focus: true
|
||||
|
||||
delegate: Item {
|
||||
property url source: object.value.get("path").value
|
||||
id: imageDelegate
|
||||
property string source: object.value.get("path").value
|
||||
width: grid.cellWidth
|
||||
height: grid.cellHeight
|
||||
Image {
|
||||
|
@ -56,12 +64,31 @@ Item {
|
|||
id: imageMA
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
onPressed: {
|
||||
grid.currentIndex = index
|
||||
grid.forceActiveFocus()
|
||||
if(mouse.button == Qt.RightButton)
|
||||
imageMenu.popup()
|
||||
else
|
||||
grid.forceActiveFocus()
|
||||
}
|
||||
}
|
||||
}
|
||||
Menu {
|
||||
id: imageMenu
|
||||
MenuItem {
|
||||
text: "Show Containing Folder"
|
||||
onClicked: {
|
||||
Qt.openUrlExternally(dirname(imageDelegate.source))
|
||||
}
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: "Remove"
|
||||
enabled: !root.readOnly
|
||||
onClicked: removeImageRequest(object)
|
||||
}
|
||||
}
|
||||
}
|
||||
DropArea {
|
||||
id: dropArea
|
||||
|
|
|
@ -256,9 +256,11 @@ ApplicationWindow {
|
|||
ImageGallery {
|
||||
id: imageGallery
|
||||
property variant node: _reconstruction.graph.nodes.get("CameraInit_1")
|
||||
readOnly: _reconstruction.computing
|
||||
model: node ? node.attribute("viewpoints").value : undefined
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
onRemoveImageRequest: _reconstruction.removeAttribute(attribute)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue