removed doubled clone in model::paste

This commit is contained in:
2025-08-24 14:19:39 +02:00
parent ff536243ac
commit 399366cecf
4 changed files with 10 additions and 8 deletions

View File

@@ -48,6 +48,7 @@ void XQSimpleClipBoard::saveNodes( const QModelIndexList& list )
for( auto entry : list )
{
XQNodePtr contentNode = XQItem::xqItemFromIndex( entry ).contentNode();
qDebug() << " --- Cloned: " << contentNode->friendly_name();
// im clipboard brauchen wir eine eltern-lose kopie des knotens
push_back( {entry.row(), contentNode->own_pos(), contentNode->clone() } );
}

View File

@@ -383,12 +383,10 @@ void XQViewModel::cmdPaste( XQCommand& command )
// wir pasten das clipboard
for (auto& entry : _clipBoard )
{
// WARUM zwei mal klonen ?
// noch ein clone vom clone erzeugen ...
// noch einen clone vom clone im clipboard erzeugen ...
XQNodePtr newNode = entry.contentNode->clone(section.contentRootNode() );
newNode->clone(section.contentRootNode() )->add_me_at( nodePos );
// ... diesen einfügen ...
newNode->add_me_at( nodePos );
// ... und damit eine frische item-row erzeugen
XQItemList list = _itemFactory.makeRow( XQItemFactory::mData, section.sheetRootNode(), newNode );
insertRow( insRow, list );