mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-28 22:17:40 +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 {
|
Menu {
|
||||||
id: settingsMenu
|
id: settingsMenu
|
||||||
|
MenuItem {
|
||||||
|
text: "Advanced Attributes"
|
||||||
|
checked: GraphEditorSettings.showAdvancedAttributes
|
||||||
|
onClicked: GraphEditorSettings.showAdvancedAttributes = !GraphEditorSettings.showAdvancedAttributes
|
||||||
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: "Open Cache Folder"
|
text: "Open Cache Folder"
|
||||||
onClicked: Qt.openUrlExternally(Filepath.stringToUrl(node.internalFolder))
|
onClicked: Qt.openUrlExternally(Filepath.stringToUrl(node.internalFolder))
|
||||||
|
@ -87,21 +92,32 @@ ColumnLayout {
|
||||||
id: attributesListView
|
id: attributesListView
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: 4
|
anchors.margins: 2
|
||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
spacing: 1
|
spacing: 2
|
||||||
ScrollBar.vertical: ScrollBar { id: scrollBar }
|
ScrollBar.vertical: ScrollBar { id: scrollBar }
|
||||||
|
|
||||||
model: node ? node.attributes : undefined
|
model: SortFilterDelegateModel {
|
||||||
|
|
||||||
delegate: AttributeItemDelegate {
|
model: node ? node.attributes : null
|
||||||
readOnly: root.isCompatibilityNode
|
filterRole: GraphEditorSettings.showAdvancedAttributes ? "" : "advanced"
|
||||||
labelWidth: 180
|
filterValue: false
|
||||||
width: attributesListView.width
|
function modelData(item, roleName) {
|
||||||
attribute: object
|
return item.model.object.desc[roleName]
|
||||||
onDoubleClicked: root.attributeDoubleClicked(attr)
|
}
|
||||||
|
|
||||||
|
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
|
// Helper MouseArea to lose edit/activeFocus
|
||||||
// when clicking on the background
|
// when clicking on the background
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|
|
@ -331,26 +331,34 @@ RowLayout {
|
||||||
id: groupAttribute_component
|
id: groupAttribute_component
|
||||||
ListView {
|
ListView {
|
||||||
id: chilrenListView
|
id: chilrenListView
|
||||||
model: attribute.value
|
|
||||||
implicitWidth: parent.width
|
implicitWidth: parent.width
|
||||||
implicitHeight: childrenRect.height
|
implicitHeight: childrenRect.height
|
||||||
onCountChanged: forceLayout()
|
onCountChanged: forceLayout()
|
||||||
spacing: 2
|
spacing: 2
|
||||||
|
model: SortFilterDelegateModel {
|
||||||
|
model: attribute.value
|
||||||
|
filterRole: GraphEditorSettings.showAdvancedAttributes ? "" : "advanced"
|
||||||
|
filterValue: false
|
||||||
|
|
||||||
delegate: RowLayout {
|
function modelData(item, roleName) {
|
||||||
id: row
|
return item.model.object.desc[roleName]
|
||||||
width: chilrenListView.width
|
}
|
||||||
property var childAttrib: object
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
delegate: RowLayout {
|
||||||
var cpt = Qt.createComponent("AttributeItemDelegate.qml")
|
id: row
|
||||||
var obj = cpt.createObject(row,
|
width: chilrenListView.width
|
||||||
{'attribute': Qt.binding(function() { return row.childAttrib }),
|
property var childAttrib: object
|
||||||
'readOnly': Qt.binding(function() { return root.readOnly })
|
|
||||||
})
|
Component.onCompleted: {
|
||||||
obj.Layout.fillWidth = true
|
var cpt = Qt.createComponent("AttributeItemDelegate.qml")
|
||||||
obj.labelWidth = 100 // reduce label width for children (space gain)
|
var obj = cpt.createObject(row,
|
||||||
obj.doubleClicked.connect(function(attr) {root.doubleClicked(attr)})
|
{'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
|
AttributeItemDelegate 1.0 AttributeItemDelegate.qml
|
||||||
CompatibilityBadge 1.0 CompatibilityBadge.qml
|
CompatibilityBadge 1.0 CompatibilityBadge.qml
|
||||||
CompatibilityManager 1.0 CompatibilityManager.qml
|
CompatibilityManager 1.0 CompatibilityManager.qml
|
||||||
|
singleton GraphEditorSettings 1.0 GraphEditorSettings.qml
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue