/*************************************************************************** source::worx xtree Copyright © 2024-2025 c.holzheuer christoph.holzheuer@gmail.com This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. ***************************************************************************/ #include #include #include #include #include #include #include #include #include #include //! default konstruktor. XQMainModel::XQMainModel(QObject *parent ) : XQViewModel{parent} { } //! leere default implementation void XQMainModel::initContextMenu() { } //! erzeugt einen eintrag in der baum-übersicht. XQItem* XQMainModel::makeTreeItem( 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() ) { qDebug() << " --- wtf1: " << contentNode->to_string(); qDebug() << " --- wtf2: " << section.sectionRootNode()->to_string(); qDebug() << " --- wtf3: " << section.sheetRootNode()->to_string(); const QString* contentPtr = contentNode->attribute_ptr( "ProjectName" ); // __fixme! das ist mist! XQItem* newItem = _itemFactory.makeItem(section.sheetRootNode()->child(0), contentPtr ); section.headerItem().appendRow( newItem ); _treeTable->expand( section.modelIndex() ); // ?? _treeTable->setCurrentIndex( section.modelIndex() ); newItem->setContentNode(contentNode); emit itemCreated( newItem ); return newItem; } } throw XQException( "makeTreeItem: main model should not be empty!" ); }