reworked model sections.

This commit is contained in:
2025-08-14 21:36:39 +02:00
parent a6fb7e82bd
commit 0d7ab33c74
13 changed files with 79 additions and 70 deletions

View File

@@ -28,6 +28,7 @@ const QString c_ItemType = "ItemType";
const QString c_Caption = "Caption";
const QString c_Header = "Header";
const QString c_ContentType = "ContentType";
const QString c_Data = "Data";
const QString c_MainModelName = "DocumentTreeModel";
const QString c_ChildModelName = "DocumentDetailsModel";

View File

@@ -47,20 +47,14 @@ void XQChildModel::setContent( const XQNodePtr& contentRoot )
// haben, hier: <Panel>. <Battery> ...
for (const auto& contentEntry : _contentRoot->children())
{
qDebug() << " --- GOGOGO: 00: " << contentEntry->to_string();
// Das ist hier der Typ des Eintrags: Panel, Battery ...
QString key = contentEntry->tag_name();
qDebug() << " --- GOGOGO: " << key;
// 'silent failure' hier der Datenbaum kann auch Knoten enthalten
// die nicht für uns gedacht sind.
if (!_sections.hasValidSection(key))
continue;
qDebug() << " --- GOGOGO: FOUND!" << key;
XQModelSection& section = _sections.at( key );
// wir speichern das parent des datenknoten auch in der
// section.
@@ -70,8 +64,6 @@ void XQChildModel::setContent( const XQNodePtr& contentRoot )
XQItemList list = _itemFactory.makeContentRow( section.sheetRootNode, contentEntry );
qDebug() << " --- AHJA: " << key << " -- last Row dazu: " << newRow;
// als Baum?
//section.headerItem().appendRow( list );
insertRow( newRow, list);

View File

@@ -40,6 +40,7 @@ XQMainModel::XQMainModel(QObject *parent )
XQItem* XQMainModel::createTreeEntry( XQNodePtr contentNode )
{
/*
for(const auto& section : _sections )
{
qDebug() << " --- wtf1: " << contentNode->to_string();
@@ -47,7 +48,20 @@ XQItem* XQMainModel::createTreeEntry( XQNodePtr contentNode )
if( contentNode->attribute("State") == section.sheetRootNode->attribute("State") )
{
XQItem* newTreeentry = _itemFactory.makeTreeChildItem( contentNode, section.sheetRootNode );
//XQItem* newTreeentry = _itemFactory.makeTreeChildItem( contentNode, section.sheetRootNode );
makeTreeChildItem:
// den itemtype des neuen items rausfinden
QString typeKey = sheetEntry->attribute("ItemType");
XQItemType* itemType = findItemTypeTemplate(typeKey); // throws
//XQItemType* itemType = makeItemType(sheetEntry); // throws
const QString* contentPtr = contentNode->attribute_ptr( "ProjectName" );
XQItem* newItem = new XQItem( itemType, contentPtr );
return newItem;
section.headerItem().appendRow( newTreeentry );
_treeTable->expand( section.modelIndex );
// ??
@@ -57,6 +71,7 @@ XQItem* XQMainModel::createTreeEntry( XQNodePtr contentNode )
return newTreeentry;
}
}
*/
throw XQException( "createTreeEntry: main model should not be empty!" );
}