invented creation-mode for items

This commit is contained in:
2025-08-23 19:33:29 +02:00
parent 3a5fbad33e
commit e0a50bade4
9 changed files with 44 additions and 32 deletions

View File

@@ -65,10 +65,6 @@ class XQModelSectionList : public XQMaptor<XQModelSection>
{
public:
XQModelSectionList() = default;
virtual ~XQModelSectionList() = default;
void createSectionEntry(const XQItemList& list, const XQNodePtr& sheetNode );
bool hasValidSection(const QString& sectionKey) const;
const XQModelSection& sectionFromRow( int row ) const;

View File

@@ -111,7 +111,7 @@ void XQViewModel::initModel(const QString& modelName)
const XQNodePtr header = sectionNode->find_child_by_tag_name( c_Header );
if( header )
{
XQItemList list = _itemFactory.makeRow( header, nullptr );
XQItemList list = _itemFactory.makeRow( XQItemFactory::mHeader, header, nullptr );
addSection(list, sectionNode );
}
}
@@ -138,9 +138,6 @@ void XQViewModel::addSection(const XQItemList& list, const XQNodePtr& sectionNod
// 5. das erzeugt dann auch valide indices
appendRow(list);
// 6. die beschreibung der daten liegt im unterknoten 'Data'
// 6. jetzt können wir auch die sction erzeugen
XQModelSection section(list[0]->index(), sectionNode );
_sections.addAtKey(sectionNode->attribute( c_ContentType), section);
@@ -355,7 +352,7 @@ void XQViewModel::cmdCutUndo( XQCommand& command )
const XQNodePtr& savedNode = entry.contentNode;
// __fix! should not be _contentRoot!
savedNode->add_me_at( entry.nodePos, _contentRoot );
XQItemList list = _itemFactory.makeRow( section.sheetRootNode(), savedNode );
XQItemList list = _itemFactory.makeRow( XQItemFactory::mData, section.sheetRootNode(), savedNode );
XQItem& firstItem = *((XQItem*)list[0]);
qDebug() << " --- Cut Undo: " << firstItem.text() << " " << firstItem.row() << " id#" << entry.contentNode->_id << " count: " << entry.contentNode.use_count();
@@ -393,7 +390,7 @@ void XQViewModel::cmdPaste( XQCommand& command )
XQNodePtr newNode = entry.contentNode->clone(section.contentRootNode() );
newNode->clone(section.contentRootNode() )->add_me_at( nodePos );
// ... und damit eine frische item-row erzeugen
XQItemList list = _itemFactory.makeRow( section.sheetRootNode(), newNode );
XQItemList list = _itemFactory.makeRow( XQItemFactory::mData, section.sheetRootNode(), newNode );
insertRow( insRow, list );
// die neue item-row selektieren
const QModelIndex& selIdx = list[0]->index();