diff --git a/src/application/xqchildmodel.cpp b/src/application/xqchildmodel.cpp index 54bb88d..0157aa2 100644 --- a/src/application/xqchildmodel.cpp +++ b/src/application/xqchildmodel.cpp @@ -36,9 +36,6 @@ XQChildModel::XQChildModel( QObject *parent ) void XQChildModel::addModelData( const XQNodePtr& contentRoot ) { - setObjectName( contentRoot->to_string() ); - //qDebug() << " --- create Model Data: " << contentRoot->to_string(); - // Die Datenbasis als shared_ptr sichern _contentRoot = contentRoot; diff --git a/src/application/xqmainwindow.cpp b/src/application/xqmainwindow.cpp index 3e74673..684bb9d 100644 --- a/src/application/xqmainwindow.cpp +++ b/src/application/xqmainwindow.cpp @@ -117,9 +117,9 @@ void XQMainWindow::initMainWindow() // #2. load demo data loadDocument( c_DocumentFileName1 ); - //loadDocument( c_DocumentFileName2, true ); + loadDocument( c_DocumentFileName2, true ); //loadDocument( c_DocumentFileName2 ); - loadDocument( c_DocumentFileName3 ); + //loadDocument( c_DocumentFileName3 ); qDebug() << " --- all here: " << XQNode::s_Count; @@ -260,7 +260,7 @@ void XQMainWindow::onTreeViewItemClicked( const XQItem& item ) void XQMainWindow::onTreeViewItemChanged(const XQItem& item ) { - qDebug() << " --- TREE VIEW itemChanged:" << item.text() << " : " << item.parent()->text() << " : " << (void*)&_mainModel << " : " << (void*) sender(); + qDebug() << " --- TREE VIEW itemChanged: text" << item.text() << " parent: " << item.parent()->text() << " type: " << item.itemType().text() << " : " << (void*)&_mainModel << " : " << (void*) sender(); // hier müssen wir erst das projekt aktivieren XQItem* xqItem = static_cast(item.parent()); onTreeViewItemClicked( *xqItem ); @@ -269,7 +269,7 @@ void XQMainWindow::onTreeViewItemChanged(const XQItem& item ) int idx = _tabWidget->currentIndex(); if(_documentStore.contains(idx) ) { - qDebug() << " --- should toggle: " << item.text(); + qDebug() << " --- Has Document and might toggle: " << item.text(); XQViewModel& childModel = *_documentStore[idx].viewModel; childModel.onToggleSection(item.text()); } @@ -362,6 +362,7 @@ XQChildModel* XQMainWindow::createChildModel( const XQNodePtr& contentRoot ) // model inhalte laden childModel->addModelData( contentRoot->first_child() ); + childModel->setObjectName( contentRoot->friendly_name() ); return childModel; @@ -404,7 +405,7 @@ void XQMainWindow::loadDocument( const QString& fileName, bool useQML ) QWidget* childView{}; if(useQML) { - XQQuickWidget* quickView= new XQQuickWidget(_tabWidget); + XQQuickWidget* quickView = new XQQuickWidget(_tabWidget); //quickChild->setResizeMode(QQuickWidget::SizeViewToRootObject); quickView->rootContext()->setContextProperty("xtrChildModel", childModel); diff --git a/src/model/xqsectionmanager.cpp b/src/model/xqsectionmanager.cpp index 437e91f..b0c0ad9 100644 --- a/src/model/xqsectionmanager.cpp +++ b/src/model/xqsectionmanager.cpp @@ -117,7 +117,7 @@ const XQModelSection& XQSectionManager::sectionByKey( const QString& sectionKey if( hasValidSection( sectionKey ) ) return _sections.at(sectionKey); - throw XQException( "No section for key: ", sectionKey); + throw XQException( "No section for key", sectionKey); } @@ -137,7 +137,7 @@ const XQModelSection& XQSectionManager::sectionByRow(int itemRow ) const return section; } - throw XQException( "No section for item row: ", QString::number(itemRow)); + throw XQException( "No section for item row", QString::number(itemRow)); } diff --git a/src/model/xqviewmodel.cpp b/src/model/xqviewmodel.cpp index 6e90636..dc03910 100644 --- a/src/model/xqviewmodel.cpp +++ b/src/model/xqviewmodel.cpp @@ -181,8 +181,11 @@ void XQViewModel::addSection(const XQItemList& list, const XQNodePtr& sheetNode //! SLOT, toggled die section mit dem 'sectionKey' (hier: contentType) void XQViewModel::onToggleSection(const QString& sectionKey ) -{ - toggleSection( _sections.sectionByKey(sectionKey) ); +{ + qDebug() << " --- Model: " << this->objectName() << " should toggle: " << sectionKey << ": " << _sections.hasValidSection( sectionKey ); + _sections.dump(); + if(_sections.hasValidSection( sectionKey ) ) + toggleSection( _sections.sectionByKey(sectionKey) ); } diff --git a/xml/saved_testfile.xtr b/xml/saved_testfile.xtr index c2fec54..6a12a0d 100644 --- a/xml/saved_testfile.xtr +++ b/xml/saved_testfile.xtr @@ -1,23 +1,22 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - + + +