removed doubled clone in model::paste
This commit is contained in:
@@ -86,10 +86,13 @@ XQItem* XQMainModel::addProjectItem( XQNodePtr contentNode )
|
|||||||
|
|
||||||
void XQMainModel::addSectionItem( const XQModelSection& section, XQItem* projectItem )
|
void XQMainModel::addSectionItem( const XQModelSection& section, XQItem* projectItem )
|
||||||
{
|
{
|
||||||
/*
|
return;
|
||||||
|
qDebug() << " --- addSecxtion: " << projectItem->sheetNode()->to_string();
|
||||||
|
return;
|
||||||
|
|
||||||
XQNodePtr sheetNode = projectItem->sheetNode()->find_child_by_tag_name("CurrentSection");
|
XQNodePtr sheetNode = projectItem->sheetNode()->find_child_by_tag_name("CurrentSection");
|
||||||
XQItemList list = _itemFactory.makeRow( XQItemFactory::mSingle, sheetNode, nullptr, c_ContentType );
|
XQItemList list = _itemFactory.makeRow( XQItemFactory::mSingle, sheetNode, nullptr, c_ContentType );
|
||||||
projectItem->appendRow( list );
|
projectItem->appendRow( list );
|
||||||
_treeTable->expand( projectItem->index() );
|
_treeTable->expand( projectItem->index() );
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
@@ -117,7 +117,7 @@ void XQMainWindow::initMainWindow()
|
|||||||
|
|
||||||
// #2. load demo data
|
// #2. load demo data
|
||||||
loadDocument( c_DocumentFileName1 );
|
loadDocument( c_DocumentFileName1 );
|
||||||
loadDocumentQML( c_DocumentFileName2 );
|
//loadDocumentQML( c_DocumentFileName2 );
|
||||||
|
|
||||||
qDebug() << " --- all here: " << XQNode::s_Count;
|
qDebug() << " --- all here: " << XQNode::s_Count;
|
||||||
|
|
||||||
|
@@ -48,6 +48,7 @@ void XQSimpleClipBoard::saveNodes( const QModelIndexList& list )
|
|||||||
for( auto entry : list )
|
for( auto entry : list )
|
||||||
{
|
{
|
||||||
XQNodePtr contentNode = XQItem::xqItemFromIndex( entry ).contentNode();
|
XQNodePtr contentNode = XQItem::xqItemFromIndex( entry ).contentNode();
|
||||||
|
qDebug() << " --- Cloned: " << contentNode->friendly_name();
|
||||||
// im clipboard brauchen wir eine eltern-lose kopie des knotens
|
// im clipboard brauchen wir eine eltern-lose kopie des knotens
|
||||||
push_back( {entry.row(), contentNode->own_pos(), contentNode->clone() } );
|
push_back( {entry.row(), contentNode->own_pos(), contentNode->clone() } );
|
||||||
}
|
}
|
||||||
|
@@ -383,12 +383,10 @@ void XQViewModel::cmdPaste( XQCommand& command )
|
|||||||
// wir pasten das clipboard
|
// wir pasten das clipboard
|
||||||
for (auto& entry : _clipBoard )
|
for (auto& entry : _clipBoard )
|
||||||
{
|
{
|
||||||
|
// noch einen clone vom clone im clipboard erzeugen ...
|
||||||
// WARUM zwei mal klonen ?
|
|
||||||
|
|
||||||
// noch ein clone vom clone erzeugen ...
|
|
||||||
XQNodePtr newNode = entry.contentNode->clone(section.contentRootNode() );
|
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
|
// ... und damit eine frische item-row erzeugen
|
||||||
XQItemList list = _itemFactory.makeRow( XQItemFactory::mData, section.sheetRootNode(), newNode );
|
XQItemList list = _itemFactory.makeRow( XQItemFactory::mData, section.sheetRootNode(), newNode );
|
||||||
insertRow( insRow, list );
|
insertRow( insRow, list );
|
||||||
|
Reference in New Issue
Block a user