Skip to content

Commit 45faa86

Browse files
committed
[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
1 parent b42f637 commit 45faa86

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

meshroom/ui/qml/GraphEditor/AttributeEditor.qml

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,23 @@ ListView {
1919

2020
implicitHeight: contentHeight
2121

22-
clip: true
2322
spacing: 2
23+
clip: true
2424
ScrollBar.vertical: ScrollBar { id: scrollBar }
2525

26-
model: SortFilterDelegateModel {
26+
model: attributes
2727

28-
model: attributes
29-
filterRole: GraphEditorSettings.showAdvancedAttributes ? "" : "advanced"
30-
filterValue: false
31-
32-
function modelData(item, roleName) {
33-
return item.model.object.desc[roleName]
34-
}
28+
delegate: Loader {
29+
active: !object.desc.advanced || GraphEditorSettings.showAdvancedAttributes
30+
visible: active
31+
height: item ? item.implicitHeight : -spacing // compensate for spacing if item is hidden
3532

36-
Component {
37-
id: delegateComponent
38-
AttributeItemDelegate {
39-
width: ListView.view.width - scrollBar.width
40-
readOnly: root.readOnly
41-
labelWidth: root.labelWidth
42-
attribute: object
43-
onDoubleClicked: root.attributeDoubleClicked(mouse, attr)
44-
}
33+
sourceComponent: AttributeItemDelegate {
34+
width: root.width - scrollBar.width
35+
readOnly: root.readOnly
36+
labelWidth: root.labelWidth
37+
attribute: object
38+
onDoubleClicked: root.attributeDoubleClicked(mouse, attr)
4539
}
4640
}
4741

0 commit comments

Comments
 (0)