Added subitems for sections.

This commit is contained in:
2025-09-28 10:59:05 +02:00
parent 4996c03b39
commit 007970f4ee
4 changed files with 40 additions and 11 deletions

View File

@@ -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() << " -> " <<contentKey;
qDebug() << " --- Na Hopp2: " << sheetNode->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 );
}
}

View File

@@ -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:

View File

@@ -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 ) );

View File

@@ -206,6 +206,11 @@ namespace znode
return !children().empty();
}
bool has_child(int idx) const
{
return (idx>-1 && idx<children().size());
}
//! testet, ob kinder vorhanden sind.
bool has_child(str_cref tagname ) const
{