mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-06-05 12:21:59 +02:00
[ui] AttributeEditor: remove SortFilterDelegateModel
Usage of DelegateModel for model filtering has not proven to be the most stable solution, and might be responsible for random crashes happening during engine's garbage collection. Implement Loader-based alternative: * first delegate is a Loader which creates the AttributeItemDelegate if necessary * compensate spacing using negative height when element is hidden
This commit is contained in:
parent
b42f637ac0
commit
45faa860c9
1 changed files with 12 additions and 18 deletions
|
@ -19,29 +19,23 @@ ListView {
|
|||
|
||||
implicitHeight: contentHeight
|
||||
|
||||
clip: true
|
||||
spacing: 2
|
||||
clip: true
|
||||
ScrollBar.vertical: ScrollBar { id: scrollBar }
|
||||
|
||||
model: SortFilterDelegateModel {
|
||||
model: attributes
|
||||
|
||||
model: attributes
|
||||
filterRole: GraphEditorSettings.showAdvancedAttributes ? "" : "advanced"
|
||||
filterValue: false
|
||||
delegate: Loader {
|
||||
active: !object.desc.advanced || GraphEditorSettings.showAdvancedAttributes
|
||||
visible: active
|
||||
height: item ? item.implicitHeight : -spacing // compensate for spacing if item is hidden
|
||||
|
||||
function modelData(item, roleName) {
|
||||
return item.model.object.desc[roleName]
|
||||
}
|
||||
|
||||
Component {
|
||||
id: delegateComponent
|
||||
AttributeItemDelegate {
|
||||
width: ListView.view.width - scrollBar.width
|
||||
readOnly: root.readOnly
|
||||
labelWidth: root.labelWidth
|
||||
attribute: object
|
||||
onDoubleClicked: root.attributeDoubleClicked(mouse, attr)
|
||||
}
|
||||
sourceComponent: AttributeItemDelegate {
|
||||
width: root.width - scrollBar.width
|
||||
readOnly: root.readOnly
|
||||
labelWidth: root.labelWidth
|
||||
attribute: object
|
||||
onDoubleClicked: root.attributeDoubleClicked(mouse, attr)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue