diff --git a/src/application/xqmainmodel.cpp b/src/application/xqmainmodel.cpp
index 1e62c17..d244624 100644
--- a/src/application/xqmainmodel.cpp
+++ b/src/application/xqmainmodel.cpp
@@ -43,7 +43,7 @@ void XQMainModel::initContextMenu()
//! erzeugt einen eintrag in der baum-übersicht.
-XQItem* XQMainModel::makeTreeItem( XQNodePtr contentNode )
+XQItem* XQMainModel::addProjectItem( XQNodePtr contentNode )
{
// wir durchsuchen alle unsere section nach dem passenden content-type,
// hier: content-type beschreibt die
@@ -52,20 +52,21 @@ XQItem* XQMainModel::makeTreeItem( XQNodePtr contentNode )
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 );
-
+ const XQNodePtr sheetNode = section.sheetRootNode()->first_child();
+ XQItem* newItem = _itemFactory.makeItem(sheetNode, contentPtr );
+ // den neuen eintrag in die passende section der übersicht eintragen ...
section.headerItem().appendRow( newItem );
- _treeTable->expand( section.modelIndex() );
- // ??
- _treeTable->setCurrentIndex( section.modelIndex() );
- newItem->setContentNode(contentNode);
+ // ... ausklappen...
+ const QModelIndex index = section.headerItem().index();
+ _treeTable->expand( index );
+ // ... und markieren
+ _treeTable->setCurrentIndex( index );
+ // den gesamten projekt knoten speichern, warum?
+ //newItem->setContentNode(contentNode);
+ // erzeuger sheet node speichern
+ newItem->setSheetNode( sheetNode );
emit itemCreated( newItem );
return newItem;
@@ -74,5 +75,15 @@ XQItem* XQMainModel::makeTreeItem( XQNodePtr contentNode )
}
- throw XQException( "makeTreeItem: main model should not be empty!" );
+ throw XQException( "addProjectItem: main model should not be empty!" );
}
+
+/*
+XQItem* XQMainModel::addSectionItem( XQItem* projectItem )
+{
+ const XQNodePtr& parentSheet = projectItem->sheetNode();
+ const XQNodePtr sheetNode = parentSheet->first_child();
+ return _itemFactor.makeItem( sheetNode, new QString("fitz!"));
+
+}
+*/
diff --git a/src/application/xqmainmodel.h b/src/application/xqmainmodel.h
index 355207d..79ecf28 100644
--- a/src/application/xqmainmodel.h
+++ b/src/application/xqmainmodel.h
@@ -32,7 +32,7 @@ public:
explicit XQMainModel(QObject *parent = nullptr);
virtual ~XQMainModel() = default;
- XQItem* makeTreeItem( XQNodePtr contentNode );
+ XQItem* addProjectItem( XQNodePtr contentNode );
public slots:
diff --git a/src/application/xqmainwindow.cpp b/src/application/xqmainwindow.cpp
index 5a9a088..1193f2e 100644
--- a/src/application/xqmainwindow.cpp
+++ b/src/application/xqmainwindow.cpp
@@ -281,6 +281,10 @@ void XQMainWindow::onTabClicked( int index )
void XQMainWindow::onSectionCreated( const XQModelSection& section )
{
+ if( _currentProjectItem )
+ {
+ ;
+ }
qDebug() << " --- XXX section created: " << section.contentType() << ":" << section.contentType();
}
@@ -339,9 +343,10 @@ void XQMainWindow::loadDocument( const QString& fileName )
childModel->setTreeTable(childTreeView);
// neuen eintrag im übsichts-baum erzeugen
- XQItem* newEntry = _mainModelView.makeTreeItem( contentRoot );
- //_mainTreeView->setCurrentIndex( newEntry->index() );
- //_documentStore.addDocument( fileName, pTitle, newEntry, childModel );
+ _currentProjectItem = _mainModelView.addProjectItem( contentRoot );
+ _documentStore.addDocument( fileName, pTitle, _currentProjectItem, childModel );
+
+ qDebug() << " --- ZZZ und jetzt:";
// die Modelstruktur anlegen
childModel->initModel( c_ChildModelName );
diff --git a/src/application/xqmainwindow.h b/src/application/xqmainwindow.h
index 08013ff..5f9cead 100644
--- a/src/application/xqmainwindow.h
+++ b/src/application/xqmainwindow.h
@@ -67,6 +67,7 @@ protected:
XQDocumentStore _documentStore;
XQMainModel _mainModelView;
+ XQItem* _currentProjectItem{};
};
diff --git a/xml/modelsheets.xml b/xml/modelsheets.xml
index 9c842e9..99c80bc 100644
--- a/xml/modelsheets.xml
+++ b/xml/modelsheets.xml
@@ -7,17 +7,18 @@
-->
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -27,15 +28,19 @@
-
+
+
+
-
+
@@ -43,11 +48,13 @@
-
+
+
+
-
+