mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-03 08:48:40 +02:00
[ImageGallery] Initialize and use "attribute" properly for the intrinsics table
This commit fixes an "Unable to assign QJSValue to QObject*". In IntrinsicDisplayDelegate, initialize the "attribute" variant to null and set it as a parameter during the instantiation in ImageGallery. All references to "model.display" in IntrinsicDisplayDelegate have been replaced with a correct use of "attribute".
This commit is contained in:
parent
1fc2b228af
commit
7bdd7cf9d6
2 changed files with 12 additions and 10 deletions
|
@ -9,12 +9,12 @@ RowLayout {
|
|||
|
||||
Layout.fillWidth: true
|
||||
|
||||
property variant attribute: model.display
|
||||
property variant attribute: null
|
||||
property int rowIndex: model.row
|
||||
property int columnIndex: model.column
|
||||
property bool readOnly: false
|
||||
property string toolTipText: {
|
||||
if(!attribute || Object.keys(attribute).length === 0)
|
||||
if (!attribute || Object.keys(attribute).length === 0)
|
||||
return ""
|
||||
return attribute.fullLabel
|
||||
}
|
||||
|
@ -44,11 +44,11 @@ RowLayout {
|
|||
clip: true
|
||||
Loader {
|
||||
id: loaderComponent
|
||||
active: !!model.display // convert to bool with "!!"
|
||||
active: !!attribute // convert to bool with "!!"
|
||||
sourceComponent: {
|
||||
if(!model.display)
|
||||
if (!attribute)
|
||||
return undefined
|
||||
switch(model.display.type)
|
||||
switch (attribute.type)
|
||||
{
|
||||
case "ChoiceParam": return choice_component
|
||||
case "IntParam": return int_component
|
||||
|
@ -65,7 +65,7 @@ RowLayout {
|
|||
Component {
|
||||
id: textField_component
|
||||
TextInput{
|
||||
text: model.display.value
|
||||
text: attribute.value
|
||||
width: intrinsicModel.columnWidths[columnIndex]
|
||||
horizontalAlignment: TextInput.AlignRight
|
||||
color: 'white'
|
||||
|
@ -155,7 +155,7 @@ RowLayout {
|
|||
Component {
|
||||
id: float_component
|
||||
TextInput{
|
||||
readonly property real formattedValue: model.display.value.toFixed(2)
|
||||
readonly property real formattedValue: attribute.value.toFixed(2)
|
||||
property string displayValue: String(formattedValue)
|
||||
|
||||
text: displayValue
|
||||
|
@ -179,8 +179,10 @@ RowLayout {
|
|||
//while keeping the trick for formatting the text
|
||||
//Timing issues otherwise
|
||||
onActiveFocusChanged: {
|
||||
if(activeFocus) text = String(model.display.value)
|
||||
else text = String(formattedValue)
|
||||
if (activeFocus)
|
||||
text = String(attribute.value)
|
||||
else
|
||||
text = String(formattedValue)
|
||||
cursorPosition = 0
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue