From 1531ec14f154d56a6d834fe6fbd2ab84101c15b7 Mon Sep 17 00:00:00 2001 From: "PANIK\\chris" Date: Sat, 6 Sep 2025 22:13:46 +0200 Subject: [PATCH] -- semi-fy --- src/model/xqsectionmanager.cpp | 1 + src/model/xqselectionmodel.cpp | 3 +++ src/model/xqviewmodel.cpp | 11 +++++++++-- xml/saved_testfile.xtr | 4 ++-- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/model/xqsectionmanager.cpp b/src/model/xqsectionmanager.cpp index cd67d6e..7da2fec 100644 --- a/src/model/xqsectionmanager.cpp +++ b/src/model/xqsectionmanager.cpp @@ -142,6 +142,7 @@ const XQModelSection& XQSectionManager::sectionByRow(int itemRow ) const } + const XQModelSection& XQSectionManager::createSection(const QModelIndex& modelIndex, XQNodePtr sheetNode) { const QString& sectionKey = sheetNode->attribute(c_ContentType); diff --git a/src/model/xqselectionmodel.cpp b/src/model/xqselectionmodel.cpp index bced9c2..3b2a1d1 100644 --- a/src/model/xqselectionmodel.cpp +++ b/src/model/xqselectionmodel.cpp @@ -59,6 +59,7 @@ void XQSelectionModel::select(const QItemSelection& selection, QItemSelectionMod // step 03: selektiere nur knoten, die den gleichen tag_name haben, sich also // in der selben section befinden + if( firstNode ) { QItemSelection newSelection; @@ -71,5 +72,7 @@ void XQSelectionModel::select(const QItemSelection& selection, QItemSelectionMod } return QItemSelectionModel::select(newSelection, command); } + + // fallback QItemSelectionModel::select(selection, command); } diff --git a/src/model/xqviewmodel.cpp b/src/model/xqviewmodel.cpp index cf55e79..9c089ac 100644 --- a/src/model/xqviewmodel.cpp +++ b/src/model/xqviewmodel.cpp @@ -345,7 +345,8 @@ void XQViewModel::cmdCut( const XQCommand& command ) const XQNodeBackup& entry = *it; XQItem& firstItem = xqFirstItem( (*it).itemPos ); - qDebug() << " --- Cut: " << firstItem.text() << " " << firstItem.row() << " id#" << entry.contentNode->_id; + //qDebug() << " --- Cut: " << firstItem.text() << " " << firstItem.row() << " id#" << entry.contentNode->_id; + qDebug() << " ---- command CUT: itemPos: " << entry.itemPos << " nodePos: "<< entry.nodePos << " is " << entry.contentNode->friendly_name(); entry.contentNode->unlink_self(); removeRow(entry.itemPos ); @@ -357,10 +358,14 @@ void XQViewModel::cmdCut( const XQCommand& command ) void XQViewModel::cmdCutUndo( const XQCommand& command ) { + // die anfangsposition int itmPos = command.first().itemPos; // die 'zuständige' section rausfinden const XQModelSection& section = _sections.sectionByRow( itmPos ); + + qDebug() << " --- HEADSHOT: " << itmPos << "->" << section.contentType(); + // über alle einträge ... for (auto& entry : command ) { @@ -368,11 +373,13 @@ void XQViewModel::cmdCutUndo( const XQCommand& command ) // __fix! should not be _contentRoot! savedNode->add_me_at( entry.nodePos, _contentRoot ); XQItemList list = _itemFactory.makeRow( section.sheetRootNode(), savedNode ); + insertRow( entry.itemPos, list ); XQItem& firstItem = *((XQItem*)list[0]); + + qDebug() << " ---- command cut UNDO2: itemPos: " << entry.itemPos << " nodePos: "<< entry.nodePos << " is " << entry.contentNode->friendly_name(); qDebug() << " --- Cut Undo: " << firstItem.text() << " " << firstItem.row() << " id#" << entry.contentNode->_id << " count: " << entry.contentNode.use_count(); - insertRow( entry.itemPos, list ); } } diff --git a/xml/saved_testfile.xtr b/xml/saved_testfile.xtr index b21fb3f..ac8e3ef 100644 --- a/xml/saved_testfile.xtr +++ b/xml/saved_testfile.xtr @@ -1,9 +1,9 @@ - + - +