#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().
This commit is contained in:
Stefan Crooijmans authored and Kristian Bendiksen committed 2026-11-05 08:50:36 +01:00
1 parent 0192fd8a66
commit f22f5e615e
1 file changed
+15 -7
+15 -7
View File
@@ -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<QString> 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<QString> m_collectionName;
};
template <typename SelfT, typename ItemT>
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<SelfT*> m_subCollections;
PdmChildArrayField<ItemT*> m_items;
};