diff --git a/src/application/xqchildmodel.cpp b/src/application/xqchildmodel.cpp index 2a4aaff..0e8921e 100644 --- a/src/application/xqchildmodel.cpp +++ b/src/application/xqchildmodel.cpp @@ -80,29 +80,51 @@ void XQChildModel::addModelData( const XQNodePtr& contentRoot ) // _hinter_ der letzen zeile einfügen insertRow( newRow+1, list); + // Es können noch Kind-Knoten mit + // Detail-Infos vorhanden sein. + if( contentEntry->has_children()) { - qDebug() << " --- AddModelData: CHILD Found for: :" << contentEntry->tag_name() << " sheet parent: " << sheetNode->tag_name(); - if( !sheetNode->has_children() ) + // Die Beschreibungen für die optionalen Kinder + // steck im ersten Knoten des Model-Sheets + if( !sheetNode->first_child()->has_children() ) { qDebug() << " --- no sheet node for children"; continue; - }Sehr geehrte Frau Hollerbaum, - - Derzeit in Festanstellung, kann mir aber bin aber offen - - Mein Fachgebiet ist Qt ma - addSectionChildren( list.front(), sheetNode, contentEntry ); + } + addSectionChildren( list.front(), sheetNode->first_child(), contentEntry ); } } // for } -void XQChildModel::addSectionChildren( QStandardItem* parent, const XQNodePtr& sheetEntry, const XQNodePtr& contentRoot ) +void XQChildModel::addSectionChildren( QStandardItem* parent, const XQNodePtr& sheetNode, const XQNodePtr& contentEntry ) { - for (const auto& contentEntry : contentRoot->children()) + qDebug() << " --- AddModelData: CHILD Found for: :" << contentEntry->to_string() << " sheet parent: " << sheetNode->tag_name(); + for (const auto& contentChild : contentEntry->children()) { + const QString& contentKey = contentChild->tag_name(); + qDebug() << " --- Na Hopp1: " << contentChild->to_string() << " -> " <to_string(); + // wir brauchen ein beschreibenden sheetnode für diesen content-child knoten + if( sheetNode->has_child( contentKey )) + { + const XQNodePtr& sheetChild = sheetNode->child(contentKey); + qDebug() << " --- Na Also: " << sheetChild->to_string(); + + + for( const auto& sheetX : sheetChild->children() ) + { + qDebug() << " --- --- sheetX: " << sheetX->to_string(); + } + + + XQItemList list = _itemFactory.makeRow( sheetChild, contentChild ); + //insertRow( parent->row()+1, list ); + parent->appendRow( list ); + + } } diff --git a/src/application/xqchildmodel.h b/src/application/xqchildmodel.h index c02f3ea..1ce3f0a 100644 --- a/src/application/xqchildmodel.h +++ b/src/application/xqchildmodel.h @@ -31,7 +31,7 @@ public: void addModelData(const XQNodePtr& contentRoot ); void addSectionEntry( const QString& key, const XQNodePtr& contentEntry ); - void addSectionChildren( QStandardItem* parent, const XQNodePtr& sheetEntry, const XQNodePtr& contentEntry ); + void addSectionChildren(QStandardItem* parent, const XQNodePtr& sheetNode, const XQNodePtr& contentEntry ); protected: diff --git a/src/items/xqitemfactory.cpp b/src/items/xqitemfactory.cpp index acdf223..137575a 100644 --- a/src/items/xqitemfactory.cpp +++ b/src/items/xqitemfactory.cpp @@ -153,6 +153,8 @@ XQItemList XQItemFactory::makeRow(const XQNodePtr& sheetNode, const XQNodePtr& c // value = contentNode->attributes["Capacity"]; // + // __fix! Obacht! das setzt das vorhandensein des Contents voraus! + for( const auto& sheetEntry : sheetNode->children() ) list.append( makeItem( sheetEntry, contentNode ) ); diff --git a/src/nodes/znode.h b/src/nodes/znode.h index 98e1fe1..0d838a1 100644 --- a/src/nodes/znode.h +++ b/src/nodes/znode.h @@ -206,6 +206,11 @@ namespace znode return !children().empty(); } + bool has_child(int idx) const + { + return (idx>-1 && idx