From e3be14c27b3cb58e4e6ed14d53ecc7ef4ca2c60e Mon Sep 17 00:00:00 2001 From: "PANIK\\chris" Date: Fri, 22 Aug 2025 17:52:08 +0200 Subject: [PATCH] -- backup --- src/application/xqmainmodel.cpp | 12 +++++------- src/application/xqmainwindow.cpp | 18 ++++++++---------- src/items/xqitemfactory.cpp | 8 ++++---- src/items/xqitemfactory.h | 4 ++-- src/model/xqviewmodel.h | 6 +++--- 5 files changed, 22 insertions(+), 26 deletions(-) diff --git a/src/application/xqmainmodel.cpp b/src/application/xqmainmodel.cpp index f9049a5..64f807e 100644 --- a/src/application/xqmainmodel.cpp +++ b/src/application/xqmainmodel.cpp @@ -48,7 +48,6 @@ XQItem* XQMainModel::addProjectItem( XQNodePtr contentNode ) // wir durchsuchen alle unsere section nach dem passenden content-type, // hier: content-type beschreibt die -/* for(const auto& section : _sections ) { @@ -57,12 +56,12 @@ XQItem* XQMainModel::addProjectItem( XQNodePtr contentNode ) const QString* contentPtr = contentNode->attribute_ptr( "ProjectName" ); // __fixme! das ist mist! const XQNodePtr sheetNode = section.sheetRootNode()->first_child(); - XQItem* newItem = _itemFactory.makeItem(sheetNode, contentPtr ); + XQItemList list = _itemFactory.makeHeaderRow( sheetNode, contentPtr ); // erzeuger sheet node speichern - newItem->setSheetNode( sheetNode ); + //newItem->setSheetNode( sheetNode ); // den neuen eintrag in die passende section der übersicht eintragen ... - section.headerItem().appendRow( newItem ); + section.headerItem().appendRow( list ); // ... ausklappen... const QModelIndex index = section.headerItem().index(); _treeTable->expand( index ); @@ -72,13 +71,12 @@ XQItem* XQMainModel::addProjectItem( XQNodePtr contentNode ) //newItem->setContentNode( contentNode ); //emit itemCreated( newItem ); - return newItem; + return list[0]; } } -*/ - +. throw XQException( "addProjectItem: main model should not be empty!" ); } diff --git a/src/application/xqmainwindow.cpp b/src/application/xqmainwindow.cpp index 2461b17..bb28680 100644 --- a/src/application/xqmainwindow.cpp +++ b/src/application/xqmainwindow.cpp @@ -259,20 +259,18 @@ void XQMainWindow::onTreeItemClicked(const QModelIndex& index ) qDebug() << " --- XXX mainWindow onTreeItemClicked:" << entry.text(); _mainTreeView->selectionModel()->select(index, QItemSelectionModel::Select); - //entry.setBackground( QBrush( Qt::green ) ); - QVariant variant = entry.QStandardItem::data( XQItem::ContentNodeRole ); + if( XQNodePtr contentNode = entry.contentNode() ) + { + QString key = contentNode->attribute(c_ProjectID); + qDebug() << " --- FIRZ: key: " << key; - XQNodePtr ptr = variant.value(); + bool isThere = _documentStore.contains(key); + if( isThere) + _tabWidget->setCurrentWidget( _documentStore[key].modelView->treeTable() ); + } - /* - QString key = entry.attribute(c_ProjectID); - qDebug() << " --- FIRZ: key: " << key; - bool isThere = _documentStore.contains(key); - if( isThere) - _tabWidget->setCurrentWidget( _documentStore[key].modelView->treeTable() ); - */ } diff --git a/src/items/xqitemfactory.cpp b/src/items/xqitemfactory.cpp index bd61d5b..754b391 100644 --- a/src/items/xqitemfactory.cpp +++ b/src/items/xqitemfactory.cpp @@ -306,14 +306,14 @@ XQItemList XQItemFactory::createGenericRow( const XQNodePtr& contentNode, const //! erzeugt eine header-item row. -XQItemList XQItemFactory::makeHeaderRow( const XQNodePtr& sheetNode ) +XQItemList XQItemFactory::makeHeaderRow( const XQNodePtr& sheetNode, const QString& caption ) { XQItemList list; for( const auto& sheetEntry : sheetNode->children() ) { - list.append( makeHeaderItem( sheetEntry ) ); + list.append( makeHeaderItem( sheetEntry, caption ) ); } Q_ASSERT(!list.empty()); @@ -354,7 +354,7 @@ XQItemList XQItemFactory::makeContentRow( const XQNodePtr& sheetNode, const XQNo } -XQItem* XQItemFactory::makeHeaderItem( const XQNodePtr& sheetNode ) +XQItem* XQItemFactory::makeHeaderItem( const XQNodePtr& sheetNode, const QString& caption ) { // den itemtype des neuen items rausfinden XQItemType* itemType = makeItemType(sheetNode); // throws @@ -362,7 +362,7 @@ XQItem* XQItemFactory::makeHeaderItem( const XQNodePtr& sheetNode ) // das ist Unterschied zum normalen Item: Der Titel kommt aus der Modelbeschreibung // der content wird indirect über den tag-name des sheetnode geholt - XQItem* newItem = new XQItem( itemType, sheetNode->attribute_ptr(c_Caption) ); + XQItem* newItem = new XQItem( itemType, sheetNode->attribute_ptr(caption) ); // __fixme! if( newItem->isCheckable() ) diff --git a/src/items/xqitemfactory.h b/src/items/xqitemfactory.h index 4b84ede..99bf8e4 100644 --- a/src/items/xqitemfactory.h +++ b/src/items/xqitemfactory.h @@ -34,7 +34,7 @@ public: //XQItemList makeEmptyRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode ); - XQItemList makeHeaderRow( const XQNodePtr& sheetNode ); + XQItemList makeHeaderRow( const XQNodePtr& sheetNode, const QString& caption = c_Caption ); XQItemList makeContentRow( const XQNodePtr& sheetNode, const XQNodePtr& contentNode ); // wozu ist das gut? @@ -50,7 +50,7 @@ protected: bool isValid(); - XQItem* makeHeaderItem( const XQNodePtr& sheetNode ); + XQItem* makeHeaderItem( const XQNodePtr& sheetNode, const QString& caption ); XQItem* makeContentItem( const XQNodePtr& sheetNode, const XQNodePtr& contentNode ); XQItem* makeItem( const XQNodePtr& sheetNode, const XQNodePtr& contentNode ); diff --git a/src/model/xqviewmodel.h b/src/model/xqviewmodel.h index b1ca62e..2ec8bf6 100644 --- a/src/model/xqviewmodel.h +++ b/src/model/xqviewmodel.h @@ -117,9 +117,9 @@ protected: using MemCallMap = QMap; // das eine reference auf ein globales singleton - XQItemFactory& _itemFactory; - XQSimpleClipBoard _clipBoard; - XQModelSectionList _sections; + XQItemFactory& _itemFactory; + XQSimpleClipBoard _clipBoard; + XQModelSectionList _sections; XQTreeTable* _treeTable{}; //QAbstractItemView* _treeTable{};