Enable section toggle
This commit is contained in:
		| @@ -55,13 +55,7 @@ void XQChildModel::addModelData( const XQNodePtr& contentRoot ) | ||||
|     if (!_sections.hasValidSection(key)) | ||||
|       continue; | ||||
|  | ||||
|     XQModelSection& section = _sections.at( key ); | ||||
|     // wir speichern das parent des datenknoten auch in der | ||||
|     // section. | ||||
|     // contentEntry->parent == _contentRoot, aber halt nur weil das model flach ist | ||||
|  | ||||
|     //qDebug() << " --- add section ENTRY: " <<  key << " TagName: " << contentEntry->attribute("TagName"); | ||||
|  | ||||
|     const XQModelSection& section = _sections.sectionByKey( key ); | ||||
|     section.setContentRootNode( contentEntry->parent() ); | ||||
|     int newRow = _sections.lastRow(section); | ||||
|  | ||||
| @@ -81,7 +75,7 @@ void XQChildModel::addModelData( const XQNodePtr& contentRoot ) | ||||
|  | ||||
| void XQChildModel::addSectionEntry( const QString& key, const XQNodePtr& contentEntry ) | ||||
| { | ||||
|   XQModelSection& section = _sections.at( key ); | ||||
|   const XQModelSection& section = _sections.sectionByKey( key ); | ||||
|   if(section.isValid() ) | ||||
|   { | ||||
|     section.setContentRootNode( contentEntry->parent() ); | ||||
|   | ||||
| @@ -48,6 +48,25 @@ XQItem* XQMainModel::addProjectItem( XQNodePtr contentNode ) | ||||
|   // wir durchsuchen alle unsere sections nach dem passenden content-type, | ||||
|   // hier: content-type beschreibt den projekt-status | ||||
|  | ||||
|   const QString& sectionKey = contentNode->attribute(c_ContentType); | ||||
|   if( _sections.hasValidSection( sectionKey ) ) | ||||
|   { | ||||
|     const XQModelSection& section = _sections.sectionByKey( sectionKey ); | ||||
|     qDebug() << " --- add PROJECT: contentNode: " << contentNode->to_string(); | ||||
|  | ||||
|     // __fixme! das ist mist! | ||||
|     const XQNodePtr sheetNode = section.sheetRootNode()->first_child(); | ||||
|     XQItem* newItem = _itemFactory.makeSingleItem( sheetNode, contentNode->attribute( "ProjectName") ); | ||||
|  | ||||
|     // den neuen eintrag in die passende section der übersicht eintragen ... | ||||
|     section.headerItem().appendRow( newItem ); | ||||
|     // erzeuger sheet node speichern | ||||
|     newItem->setSheetNode( sheetNode ); | ||||
|     expandNewItem(section.headerItem().index() ); | ||||
|     return newItem; | ||||
|   } | ||||
|  | ||||
|   /* | ||||
|   for(const auto& section : _sections ) | ||||
|   { | ||||
|     if( contentNode->attribute(c_ContentType) == section.contentType() ) | ||||
| @@ -66,6 +85,7 @@ XQItem* XQMainModel::addProjectItem( XQNodePtr contentNode ) | ||||
|       return newItem; | ||||
|     } | ||||
|   } | ||||
|   */ | ||||
|  | ||||
|   throw XQException( "addProjectItem: main model should not be empty!" ); | ||||
| } | ||||
|   | ||||
| @@ -140,9 +140,6 @@ void XQMainWindow::initMainWindow() | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| //! slot für zentrales undo | ||||
|  | ||||
| void XQMainWindow::onUndo() | ||||
| @@ -244,7 +241,7 @@ void XQMainWindow::onAbout() | ||||
|   QMessageBox msgBox(QMessageBox::NoIcon, "About", "", QMessageBox::Ok); | ||||
|  | ||||
|   QString text = "<b>xtree concept</b><br>"; | ||||
|   text += "2024 c.holzheuer<br><br>"; | ||||
|   text += "2024-2025 c.holzheuer<br><br>"; | ||||
|   text += "<a href=\"https://sourceworx.org/xtree\">sourceworx.org/xtree</a>"; | ||||
|  | ||||
|   msgBox.setTextFormat(Qt::RichText); // This allows you to click the link | ||||
| @@ -292,7 +289,7 @@ void XQMainWindow::onTreeViewItemChanged(const XQItem& item ) | ||||
|     { | ||||
|       qDebug() << " --- should toggle: " << item.text(); | ||||
|       XQViewModel& childModel = *_documentStore[idx].viewModel; | ||||
|       childModel.toggleSection(item.text()); | ||||
|       childModel.onToggleSection(item.text()); | ||||
|     } | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user