diff --git a/nexus_constructor/qml_models/instrument_model.py b/nexus_constructor/qml_models/instrument_model.py index 44be939fc..1a011d798 100644 --- a/nexus_constructor/qml_models/instrument_model.py +++ b/nexus_constructor/qml_models/instrument_model.py @@ -324,7 +324,17 @@ def update_child_transforms(self, component): @Slot(int, result="QVariant") def get_transform_model(self, index: int): - return self.transform_models[index] + """ + Returns the transform model for the component. + The list is 1-based due to the 0 being no parent, so we have to use index-1 here + unless the component has no transform parent (for example the sample) + :param index: The component's transform parents index. + :return: The transform model for the component. + """ + if index == 0: + return self.transform_models[index] + else: + return self.transform_models[index - 1] @Slot(str, result=str) def generate_component_name(self, base):