Meshroom/meshroom/ui/qml/GraphEditor/AttributeEditor.qml
Abdelrahman AL MAROUK b5093ac3a0 [ui] improve atts filtering and add search bar ...
...for node attributes and 3D inspector

- add search bar for node attributes
- add search bar for 3D inspector
- improve attributes filtering by adding more flexibility
and fixing some issues
2023-08-30 16:21:11 +02:00

66 lines
2.1 KiB
QML

import QtQuick 2.15
import QtQuick.Layouts 1.11
import QtQuick.Controls 2.15
import MaterialIcons 2.2
import Utils 1.0
/**
* A component to display and edit the attributes of a Node.
*/
ListView {
id: root
property bool readOnly: false
property int labelWidth: 180
property bool objectsHideable: true
property string filterText: ""
signal upgradeRequest()
signal attributeDoubleClicked(var mouse, var attribute)
implicitHeight: contentHeight
spacing: 2
clip: true
ScrollBar.vertical: ScrollBar { id: scrollBar }
delegate: Loader {
active: object.enabled && (
!objectsHideable
|| ((!object.desc.advanced || GraphEditorSettings.showAdvancedAttributes)
&& (object.isDefault && GraphEditorSettings.showDefaultAttributes || !object.isDefault && GraphEditorSettings.showModifiedAttributes)
&& (object.isOutput && GraphEditorSettings.showOutputAttributes || !object.isOutput && GraphEditorSettings.showInputAttributes)
&& (object.isLinkNested && GraphEditorSettings.showLinkAttributes || !object.isLink && GraphEditorSettings.showNotLinkAttributes))
) && object.matchText(filterText)
visible: active
sourceComponent: AttributeItemDelegate {
width: root.width - scrollBar.width
readOnly: root.readOnly
labelWidth: root.labelWidth
filterText: root.filterText
objectsHideable: root.objectsHideable
attribute: object
onDoubleClicked: root.attributeDoubleClicked(mouse, attr)
}
onActiveChanged: height = active ? item.implicitHeight : -spacing
Connections {
target: item
function onImplicitHeightChanged() {
// Handles cases where an attribute is created and its height is then updated as it is filled
height = item.implicitHeight
}
}
}
// Helper MouseArea to lose edit/activeFocus
// when clicking on the background
MouseArea {
anchors.fill: parent
onClicked: root.forceActiveFocus()
z: -1
}
}