diff --git a/src/application/xqmainmodel.cpp b/src/application/xqmainmodel.cpp index 5b7b68c..dff6018 100644 --- a/src/application/xqmainmodel.cpp +++ b/src/application/xqmainmodel.cpp @@ -45,9 +45,8 @@ void XQMainModel::initContextMenu() XQItem* XQMainModel::addProjectItem( XQNodePtr contentNode ) { - // wir durchsuchen alle unsere section nach dem passenden content-type, - // hier: content-type beschreibt die - + // wir durchsuchen alle unsere sections nach dem passenden content-type, + // hier: content-type beschreibt den projekt-status for(const auto& section : _sections ) { @@ -57,7 +56,7 @@ XQItem* XQMainModel::addProjectItem( XQNodePtr contentNode ) // __fixme! das ist mist! const XQNodePtr sheetNode = section.sheetRootNode()->first_child(); - XQItem* newItem = _itemFactory.makeSingleItem( sheetNode, contentNode->attribute( "ProjectName") ); + XQItem* newItem = _itemFactory.makeSingleItem( sheetNode, contentNode->attribute( "ProjectName") ); // den neuen eintrag in die passende section der übersicht eintragen ... section.headerItem().appendRow( newItem ); @@ -82,41 +81,17 @@ XQItem* XQMainModel::addProjectItem( XQNodePtr contentNode ) void XQMainModel::addSectionItem( const XQModelSection& section, XQItem* projectItem ) { - qDebug() << " --- SUPPA0: " << section.contentType(); if( projectItem->hasContentNode()) qDebug() << " --- SUPPA1: -> " << projectItem->contentNode()->to_string(); qDebug() << " --- SUPPA2: -> " << projectItem->sheetNode()->to_string(); qDebug() << " --- SUPPA3: -> " << projectItem->sheetNode()->find_child_by_tag_name("CurrentSection")->to_string(); - XQNodePtr sectionChild = projectItem->sheetNode()->find_child_by_tag_name("CurrentSection"); - + XQNodePtr sheetNode = projectItem->sheetNode()->find_child_by_tag_name("CurrentSection"); + XQItem* newItem = _itemFactory.makeSingleItem( sheetNode, section.contentType() ); + projectItem->appendRow( newItem ); //qDebug() << " --- SUPPA4: -> " << section.contentRootNode()->to_string(); - return; - - // - if(sectionChild) - { - //XQItemList list = _itemFactory.makeRow( XQItemFactory::mStatic, sectionChild, nullptr, section.contentType() ); - //projectItem->appendRow( list ); - _treeTable->expand( projectItem->index() ); - - } - return; - - for(const auto& xsection : _sections ) - { - - if( projectItem->contentNode()->attribute(c_ContentType) == xsection.contentType() ) - { - - //qDebug() << " --- FITZ;: contentNode: " << contentNode->to_string(); - - } - } - // ich brauche _meine_ section für den sheetNode! - /* XQNodePtr sheetNode = projectItem->sheetNode()->find_child_by_tag_name("CurrentSection"); diff --git a/src/application/xqmainwindow.cpp b/src/application/xqmainwindow.cpp index 98629a8..d0d39b2 100644 --- a/src/application/xqmainwindow.cpp +++ b/src/application/xqmainwindow.cpp @@ -258,6 +258,7 @@ void XQMainWindow::onTreeItemClicked(const QModelIndex& index ) if( XQNodePtr contentNode = entry.contentNode() ) { + //XQNodePtr contentNode = entry.contentNode() QString key = contentNode->attribute(c_ProjectID); qDebug() << " --- FIRZ: key: " << key; diff --git a/src/items/xqitem.cpp b/src/items/xqitem.cpp index be2c601..e91cde8 100644 --- a/src/items/xqitem.cpp +++ b/src/items/xqitem.cpp @@ -525,6 +525,12 @@ QVariant XQItem::data(int role ) const QVariant value = QStandardItem::data( XQItem::ContentNodeRole ); if( !value.isNull() ) return value; + + // das gibt immerhin was zurück, was auf nullptr getestet werden kann, + return QVariant::fromValue(nullptr); + + // diese variante erzieht uns zur verwendung von 'hasContentNode()' + // was ist besser ? throw XQException( "ContentNode is nullptr!"); }