From 05b7e4194b07f40dae1d97a7448c711812cd914c Mon Sep 17 00:00:00 2001 From: Damien Marchal Date: Fri, 31 Oct 2025 10:04:53 +0100 Subject: [PATCH] Fix data field widget so that it is read-only if there is a parent. In sofa it is possible, to have both a parent in a data (so copying the value on change) as well as the data to be not flag as read-only. This is a very questionnable design that can be fixed either by: - implementing in BaseData::isReadOnly so that it returns true of there is a parent - handle the case in the UI, this avoid do change a core behavior in SOFA I would prefer that we clarify and fix the expected behavior in BaseData. But until then I would support we reflact that in the UI. --- src/sofa/qt/QDisplayDataWidget.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sofa/qt/QDisplayDataWidget.cpp b/src/sofa/qt/QDisplayDataWidget.cpp index f2cb4c2..c50abc7 100644 --- a/src/sofa/qt/QDisplayDataWidget.cpp +++ b/src/sofa/qt/QDisplayDataWidget.cpp @@ -83,12 +83,11 @@ QDisplayDataWidget::QDisplayDataWidget(QWidget* parent, gridLayout_->addWidget(datainfowidget_, 0,0); numWidgets_ += 1; - DataWidget::CreatorArgument dwarg; dwarg.name = data_->getName(); dwarg.data = data_; dwarg.parent = this; - dwarg.readOnly = (data_->isReadOnly() && flags.READONLY_FLAG); + dwarg.readOnly = (data_->isReadOnly() && flags.READONLY_FLAG) || (data_->getParent() != nullptr); if( dynamic_cast(data_) != nullptr ) {