mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-06-07 13:21:56 +02:00
By setting the height on the "onLoaded" event, no height update was possible unless the component was unloaded (which happens when "active" gets set to false) first and then reloaded (which happens when "active" gets set to true). If an attribute was to be hidden (by unchecking the "advanced attributes" checkbox, for example), its content was effectively hidden, but as its height was not being updated, a blank block remained in its place. Similarly, for attributes that are filled with a lot of content after being initialized (ChoiceParams, for example), the height was set once at the attribute's initialization but never updated afterwards.
56 lines
1.4 KiB
QML
56 lines
1.4 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
|
|
|
|
signal upgradeRequest()
|
|
signal attributeDoubleClicked(var mouse, var attribute)
|
|
|
|
implicitHeight: contentHeight
|
|
|
|
spacing: 2
|
|
clip: true
|
|
ScrollBar.vertical: ScrollBar { id: scrollBar }
|
|
|
|
delegate: Loader {
|
|
active: object.enabled && (!object.desc.advanced || GraphEditorSettings.showAdvancedAttributes)
|
|
visible: active
|
|
|
|
sourceComponent: AttributeItemDelegate {
|
|
width: root.width - scrollBar.width
|
|
readOnly: root.readOnly
|
|
labelWidth: root.labelWidth
|
|
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
|
|
}
|
|
}
|
|
|