mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-29 14:37:26 +02:00
[ui] GraphEditor: show/hide advanced Attributes
* use SortFilterModels to filter out advanced attributes when hidden * add GraphEditorSettings with persistent settings related to the GraphEditor
This commit is contained in:
parent
168b573e36
commit
1c935b6b5a
4 changed files with 60 additions and 24 deletions
|
@ -46,6 +46,11 @@ ColumnLayout {
|
|||
}
|
||||
Menu {
|
||||
id: settingsMenu
|
||||
MenuItem {
|
||||
text: "Advanced Attributes"
|
||||
checked: GraphEditorSettings.showAdvancedAttributes
|
||||
onClicked: GraphEditorSettings.showAdvancedAttributes = !GraphEditorSettings.showAdvancedAttributes
|
||||
}
|
||||
MenuItem {
|
||||
text: "Open Cache Folder"
|
||||
onClicked: Qt.openUrlExternally(Filepath.stringToUrl(node.internalFolder))
|
||||
|
@ -87,21 +92,32 @@ ColumnLayout {
|
|||
id: attributesListView
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.margins: 4
|
||||
|
||||
anchors.margins: 2
|
||||
clip: true
|
||||
spacing: 1
|
||||
spacing: 2
|
||||
ScrollBar.vertical: ScrollBar { id: scrollBar }
|
||||
|
||||
model: node ? node.attributes : undefined
|
||||
model: SortFilterDelegateModel {
|
||||
|
||||
delegate: AttributeItemDelegate {
|
||||
readOnly: root.isCompatibilityNode
|
||||
labelWidth: 180
|
||||
width: attributesListView.width
|
||||
attribute: object
|
||||
onDoubleClicked: root.attributeDoubleClicked(attr)
|
||||
model: node ? node.attributes : null
|
||||
filterRole: GraphEditorSettings.showAdvancedAttributes ? "" : "advanced"
|
||||
filterValue: false
|
||||
function modelData(item, roleName) {
|
||||
return item.model.object.desc[roleName]
|
||||
}
|
||||
|
||||
Component {
|
||||
id: delegateComponent
|
||||
AttributeItemDelegate {
|
||||
width: attributesListView.width - scrollBar.width
|
||||
readOnly: root.isCompatibilityNode
|
||||
labelWidth: 180
|
||||
attribute: object
|
||||
onDoubleClicked: root.attributeDoubleClicked(attr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Helper MouseArea to lose edit/activeFocus
|
||||
// when clicking on the background
|
||||
MouseArea {
|
||||
|
|
|
@ -331,26 +331,34 @@ RowLayout {
|
|||
id: groupAttribute_component
|
||||
ListView {
|
||||
id: chilrenListView
|
||||
model: attribute.value
|
||||
implicitWidth: parent.width
|
||||
implicitHeight: childrenRect.height
|
||||
onCountChanged: forceLayout()
|
||||
spacing: 2
|
||||
model: SortFilterDelegateModel {
|
||||
model: attribute.value
|
||||
filterRole: GraphEditorSettings.showAdvancedAttributes ? "" : "advanced"
|
||||
filterValue: false
|
||||
|
||||
delegate: RowLayout {
|
||||
id: row
|
||||
width: chilrenListView.width
|
||||
property var childAttrib: object
|
||||
function modelData(item, roleName) {
|
||||
return item.model.object.desc[roleName]
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
var cpt = Qt.createComponent("AttributeItemDelegate.qml")
|
||||
var obj = cpt.createObject(row,
|
||||
{'attribute': Qt.binding(function() { return row.childAttrib }),
|
||||
'readOnly': Qt.binding(function() { return root.readOnly })
|
||||
})
|
||||
obj.Layout.fillWidth = true
|
||||
obj.labelWidth = 100 // reduce label width for children (space gain)
|
||||
obj.doubleClicked.connect(function(attr) {root.doubleClicked(attr)})
|
||||
delegate: RowLayout {
|
||||
id: row
|
||||
width: chilrenListView.width
|
||||
property var childAttrib: object
|
||||
|
||||
Component.onCompleted: {
|
||||
var cpt = Qt.createComponent("AttributeItemDelegate.qml")
|
||||
var obj = cpt.createObject(row,
|
||||
{'attribute': Qt.binding(function() { return row.childAttrib }),
|
||||
'readOnly': Qt.binding(function() { return root.readOnly })
|
||||
})
|
||||
obj.Layout.fillWidth = true
|
||||
obj.labelWidth = 100 // reduce label width for children (space gain)
|
||||
obj.doubleClicked.connect(function(attr) {root.doubleClicked(attr)})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
11
meshroom/ui/qml/GraphEditor/GraphEditorSettings.qml
Normal file
11
meshroom/ui/qml/GraphEditor/GraphEditorSettings.qml
Normal file
|
@ -0,0 +1,11 @@
|
|||
pragma Singleton
|
||||
import Qt.labs.settings 1.0
|
||||
|
||||
|
||||
/**
|
||||
* Persistent Settings related to the GraphEditor module.
|
||||
*/
|
||||
Settings {
|
||||
category: 'GraphEditor'
|
||||
property bool showAdvancedAttributes: false
|
||||
}
|
|
@ -9,3 +9,4 @@ AttributeEditor 1.0 AttributeEditor.qml
|
|||
AttributeItemDelegate 1.0 AttributeItemDelegate.qml
|
||||
CompatibilityBadge 1.0 CompatibilityBadge.qml
|
||||
CompatibilityManager 1.0 CompatibilityManager.qml
|
||||
singleton GraphEditorSettings 1.0 GraphEditorSettings.qml
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue