|
|
|
@@ -152,22 +152,22 @@ void XQViewModel::initModel(const QString& modelName)
|
|
|
|
|
//! Wrzeugt dann eine section aus einer frisch erzeugten itemlist. Der erste modelindex
|
|
|
|
|
//! der liste und der root knoten der model-beschreibung werden gespeichert.
|
|
|
|
|
|
|
|
|
|
void XQViewModel::addSection(const XQItemList& list, const XQNodePtr& sectionNode )
|
|
|
|
|
void XQViewModel::addSection(const XQItemList& list, const XQNodePtr& sheetNode )
|
|
|
|
|
{
|
|
|
|
|
// 1. die liste darf nicht leer sein
|
|
|
|
|
Q_ASSERT(!list.isEmpty());
|
|
|
|
|
// 2. sectionNode muss da sein
|
|
|
|
|
Q_ASSERT(sectionNode);
|
|
|
|
|
// 2. sheetNode muss da sein
|
|
|
|
|
Q_ASSERT(sheetNode);
|
|
|
|
|
// 3. 'ContenType' muss vorhanden sein
|
|
|
|
|
if( !sectionNode->has_attribute( c_ContentType) )
|
|
|
|
|
if( !sheetNode->has_attribute( c_ContentType) )
|
|
|
|
|
throw XQException( "section list: Section node needs attribute 'ContentType'!");
|
|
|
|
|
|
|
|
|
|
// 5. das erzeugt dann auch valide indices
|
|
|
|
|
appendRow(list);
|
|
|
|
|
|
|
|
|
|
const QString §ionKey = sectionNode->attribute(c_ContentType);
|
|
|
|
|
const QString §ionKey = sheetNode->attribute(c_ContentType);
|
|
|
|
|
// 6. jetzt können wir auch die sction erzeugen
|
|
|
|
|
const XQModelSection& section = _sections.createSection( sectionKey, list[0]->index(), sectionNode );
|
|
|
|
|
const XQModelSection& section = _sections.createSection( sectionKey, list[0]->index(), sheetNode );
|
|
|
|
|
|
|
|
|
|
// ... und es der welt mitteilen.
|
|
|
|
|
emit sectionCreated( section );
|
|
|
|
@@ -193,10 +193,11 @@ void XQViewModel::toggleSection( const XQModelSection& section )
|
|
|
|
|
XQSectionRange pos = _sections.sectionRange(section);
|
|
|
|
|
//int fstRow = _sections.firstRow(index);
|
|
|
|
|
//int lstRow = _sections.lastRow(index);
|
|
|
|
|
//_treeTable->toggleRowsHidden(fstRow, lstRow);
|
|
|
|
|
_treeTable->toggleRowsHidden(pos.firstRow, pos.lastRow );
|
|
|
|
|
qDebug() << " --- toggleSection: " << section.contentType();
|
|
|
|
|
|
|
|
|
|
// hier nicht!?
|
|
|
|
|
//emit sectionToggled(section);
|
|
|
|
|
emit sectionToggled(section);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -441,7 +442,7 @@ void XQViewModel::cmdDelete( const XQCommand& command )
|
|
|
|
|
// ... holen das erste item, das auch den content node enthält
|
|
|
|
|
const XQNodeBackup& entry = *it;
|
|
|
|
|
XQItem& firstItem = xqFirstItem( (*it).itemPos );
|
|
|
|
|
qDebug() << " --- Cut: " << firstItem.text() << " " << firstItem.row();
|
|
|
|
|
qDebug() << " --- delete: " << firstItem.text() << " " << firstItem.row();
|
|
|
|
|
// jetzt löschen
|
|
|
|
|
entry.contentNode->unlink_self();
|
|
|
|
|
removeRow(entry.itemPos );
|
|
|
|
@@ -452,7 +453,10 @@ void XQViewModel::cmdDelete( const XQCommand& command )
|
|
|
|
|
|
|
|
|
|
void XQViewModel::cmdDeleteUndo( const XQCommand& command )
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
for (const auto& entry : command)
|
|
|
|
|
{
|
|
|
|
|
qDebug() << " --- delete UNDo: " << entry.contentNode->to_string();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|