invented creation-mode for items

This commit is contained in:
2025-08-23 19:33:29 +02:00
parent 3a5fbad33e
commit e0a50bade4
9 changed files with 44 additions and 32 deletions

View File

@@ -60,13 +60,13 @@ void XQChildModel::addModelData( const XQNodePtr& contentRoot )
// section.
// contentEntry->parent == _contentRoot, aber halt nur weil das model flach ist
qDebug() << " --- add section ENTRY: " << key << " TagName: " << contentEntry->attribute("TagName");
//qDebug() << " --- add section ENTRY: " << key << " TagName: " << contentEntry->attribute("TagName");
section.setContentRootNode( contentEntry->parent() );
int newRow = _sections.lastRow(section);
XQNodePtr sheetNode = section.sheetRootNode();
XQItemList list = _itemFactory.makeRow( sheetNode, contentEntry );
XQItemList list = _itemFactory.makeRow( XQItemFactory::mData, sheetNode, contentEntry );
// als Baum?
//section.headerItem().appendRow( list );
@@ -84,7 +84,7 @@ void XQChildModel::addSectionEntry( const QString& key, const XQNodePtr& content
section.setContentRootNode( contentEntry->parent() );
int newRow = _sections.lastRow(section);
XQNodePtr sheetNode = section.sheetRootNode();
XQItemList list = _itemFactory.makeRow( sheetNode, contentEntry );
XQItemList list = _itemFactory.makeRow( XQItemFactory::mHeader, sheetNode, contentEntry );
insertRow( newRow, list);
}
}

View File

@@ -48,16 +48,18 @@ XQItem* XQMainModel::addProjectItem( XQNodePtr contentNode )
// wir durchsuchen alle unsere section nach dem passenden content-type,
// hier: content-type beschreibt die
/*
for(const auto& section : _sections )
{
if( contentNode->attribute( c_ContentType) == section.contentType() )
{
const QString* contentPtr = contentNode->attribute_ptr( "ProjectName" );
qDebug() << " --- add PROJECT: contentNode: " << contentNode->to_string();
// __fixme! das ist mist!
const XQNodePtr sheetNode = section.sheetRootNode()->first_child();
XQItemList list = _itemFactory.makeHeaderRow( sheetNode, contentPtr );
XQItemList list = _itemFactory.makeRow( XQItemFactory::mSingle, sheetNode, contentNode, "ProjectName");
// erzeuger sheet node speichern
//newItem->setSheetNode( sheetNode );
@@ -72,12 +74,12 @@ XQItem* XQMainModel::addProjectItem( XQNodePtr contentNode )
//newItem->setContentNode( contentNode );
//emit itemCreated( newItem );
return list[0];
return dynamic_cast<XQItem*>(list[0]);
}
}
*/
throw XQException( "addProjectItem: main model should not be empty!" );
}

View File

@@ -346,7 +346,7 @@ void XQMainWindow::loadDocument( const QString& fileName )
childModel->setTreeTable(childTreeView);
// neuen eintrag im übsichts-baum erzeugen
//_currentProjectItem = _mainModelView.addProjectItem( contentRoot );
_currentProjectItem = _mainModelView.addProjectItem( contentRoot );
//_documentStore.addDocument( fileName, pTitle, _currentProjectItem, childModel );
qDebug() << " --- ZZZ und jetzt:";