From 4b628269ea144d21003225519c56d5e86b35be0a Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Sat, 28 Oct 2023 08:52:17 +0800 Subject: [PATCH] Gui: do not change property view editing content Fixes #896 --- src/Gui/propertyeditor/PropertyItemDelegate.cpp | 5 ++++- src/Gui/propertyeditor/PropertyItemDelegate.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Gui/propertyeditor/PropertyItemDelegate.cpp b/src/Gui/propertyeditor/PropertyItemDelegate.cpp index 07c42d8e1471..593d5391cebd 100644 --- a/src/Gui/propertyeditor/PropertyItemDelegate.cpp +++ b/src/Gui/propertyeditor/PropertyItemDelegate.cpp @@ -177,6 +177,8 @@ QWidget * PropertyItemDelegate::createEditor (QWidget * parent, const QStyleOpti if(parentEditor) parentEditor->closeEditor(); + editingInited = false; + if (childItem->isSeparator()) return nullptr; @@ -242,8 +244,9 @@ void PropertyItemDelegate::valueChanged() void PropertyItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const { - if (!index.isValid()) + if (!index.isValid() || editingInited) return; + editingInited = true; QVariant data = index.data(Qt::EditRole); auto childItem = static_cast(index.internalPointer()); editor->blockSignals(true); diff --git a/src/Gui/propertyeditor/PropertyItemDelegate.h b/src/Gui/propertyeditor/PropertyItemDelegate.h index f5db04740665..e685545cfe40 100644 --- a/src/Gui/propertyeditor/PropertyItemDelegate.h +++ b/src/Gui/propertyeditor/PropertyItemDelegate.h @@ -57,6 +57,7 @@ public Q_SLOTS: mutable PropertyEditorWidget *userEditor = nullptr; mutable bool pressed; bool changed; + mutable bool editingInited = false; }; } // namespace PropertyEditor