From f22f5e615eb439709129001210fa87d4ef2bf816 Mon Sep 17 00:00:00 2001 From: Stefan Crooijmans Date: Wed, 4 Nov 2026 17:07:18 +0100 Subject: [PATCH] #15008 Doc: Update the nested collection API in the design notes The PdmNestedCollectionBase sketch still declared a virtual PdmObject* addNewSubCollection(). It now shows displayName(), subCollectionClassKeyword(), the non-virtual addNewSubCollection(), subCollectionsField() and the protected createSubCollection(). --- docs/pdm-nested-collection-design.md | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/docs/pdm-nested-collection-design.md b/docs/pdm-nested-collection-design.md index 2847c70486..09ae684fe0 100644 --- a/docs/pdm-nested-collection-design.md +++ b/docs/pdm-nested-collection-design.md @@ -9,18 +9,26 @@ non-template concrete base + a CRTP template: ```cpp class PdmNestedCollectionBase : public PdmObject { - QString collectionName() const; - void setCollectionName( const QString& name ); - virtual bool canAddSubCollection() const; - virtual PdmObject* addNewSubCollection(); - void setAsTopmostFolder(); - PdmField m_collectionName; +public: + QString collectionName() const; + void setCollectionName( const QString& name ); + virtual QString displayName() const; // collectionName() unless overridden + virtual bool canAddSubCollection() const; + virtual QString subCollectionClassKeyword() const = 0; // empty for a leaf + PdmNestedCollectionBase* addNewSubCollection(); // nullptr for a leaf + virtual PdmChildArrayFieldHandle* subCollectionsField() = 0; + void setAsTopmostFolder(); + +protected: + virtual PdmNestedCollectionBase* createSubCollection() = 0; + PdmField m_collectionName; }; template class PdmNestedCollection : public PdmNestedCollectionBase { - // typed accessors + storage for items and subcollections + // typed accessors + storage for items and subcollections; + // subCollectionClassKeyword() and createSubCollection() default to SelfT PdmChildArrayField m_subCollections; PdmChildArrayField m_items; };