[ui] ImageGallery: add menu + advanced option to show view IDs

This commit is contained in:
Yann Lanthony 2019-01-22 17:53:09 +01:00
parent 9805ec4861
commit d2d8090b5b
2 changed files with 41 additions and 0 deletions

View file

@ -15,6 +15,7 @@ Item {
property alias source: _viewpoint.source
property alias metadata: _viewpoint.metadata
property bool readOnly: false
property bool displayViewId: false
signal pressed(var mouse)
signal removeRequest()
@ -25,6 +26,7 @@ Item {
QtObject {
id: _viewpoint
property url source: viewpoint ? Filepath.stringToUrl(viewpoint.get("path").value) : ''
property int viewId: viewpoint ? viewpoint.get("viewId").value : -1
property string metadataStr: viewpoint ? viewpoint.get("metadata").value : ''
property var metadata: metadataStr ? JSON.parse(viewpoint.get("metadata").value) : {}
}
@ -91,6 +93,23 @@ Item {
color: root.isCurrentItem ? parent.palette.highlight : "transparent"
}
}
// Image viewId
Loader {
active: displayViewId
Layout.fillWidth: true
visible: active
sourceComponent: Label {
padding: imageLabel.padding
font.pointSize: imageLabel.font.pointSize
elide: imageLabel.elide
horizontalAlignment: imageLabel.horizontalAlignment
text: _viewpoint.viewId
background: Rectangle {
color: imageLabel.background.color
}
}
}
}
}
}

View file

@ -30,6 +30,27 @@ Panel {
title: "Images"
implicitWidth: (root.defaultCellSize + 2) * 2
headerBar: RowLayout {
MaterialToolButton {
text: MaterialIcons.more_vert
font.pointSize: 11
padding: 2
onClicked: graphEditorMenu.open()
Menu {
id: graphEditorMenu
y: parent.height
x: -width + parent.width
Menu {
title: "Advanced"
Action {
id: displayViewIdsAction
text: "Display View IDs"
checkable: true
}
}
}
}
}
ColumnLayout {
anchors.fill: parent
spacing: 4
@ -86,6 +107,7 @@ Panel {
width: grid.cellWidth
height: grid.cellHeight
readOnly: root.readOnly
displayViewId: displayViewIdsAction.checked
isCurrentItem: GridView.isCurrentItem