finally, fixed hiding of headers.

This commit is contained in:
2025-09-06 14:07:25 +02:00
parent a9dacca684
commit 89c671295f
6 changed files with 79 additions and 49 deletions

View File

@@ -165,9 +165,8 @@ void XQViewModel::addSection(const XQItemList& list, const XQNodePtr& sheetNode
// 5. das erzeugt dann auch valide indices
appendRow(list);
const QString &sectionKey = sheetNode->attribute(c_ContentType);
// 6. jetzt können wir auch die sction erzeugen
const XQModelSection& section = _sections.createSection( sectionKey, list[0]->index(), sheetNode );
// 6. jetzt können wir auch die section erzeugen
const XQModelSection& section = _sections.createSection( list[0]->index(), sheetNode );
// ... und es der welt mitteilen.
emit sectionCreated( section );
@@ -187,18 +186,17 @@ void XQViewModel::onToggleSection(const QString& sectionKey )
void XQViewModel::toggleSection( const XQModelSection& section )
{
qDebug() << " --- toggleSection: " << section.contentType();
if( section.isValid() && _treeTable )
{
XQSectionRange pos = _sections.sectionRange(section);
//int fstRow = _sections.firstRow(index);
//int lstRow = _sections.lastRow(index);
_treeTable->toggleRowsHidden(pos.firstRow, pos.lastRow );
qDebug() << " --- toggleSection: " << section.contentType();
XQSectionRange pos = _sections.sectionRange(section);
_treeTable->toggleRowsHidden(pos.firstRow, pos.lastRow );
// hier nicht!?
emit sectionToggled(section);
//emit sectionToggled(section);
}
else
{
qDebug() << " --- toggleSection: FAIL!";
}
}
@@ -217,7 +215,7 @@ void XQViewModel::onItemChanged(XQItem* item )
void XQViewModel::onActionTriggered(QAction* action)
{
qDebug() << " --- onActionTriggered: count:" << XQNode::s_Count;
qDebug() << " --- onActionTriggered: count:" << action->text() <<": " << XQNode::s_Count;
// all selected indices
QModelIndexList selectionList = treeTable()->selectionModel()->selectedRows();
@@ -226,6 +224,7 @@ void XQViewModel::onActionTriggered(QAction* action)
switch( cmdType )
{
// just handle undo ...
case XQCommand::cmdUndo :
return _undoStack->undo();
@@ -250,14 +249,15 @@ void XQViewModel::onActionTriggered(QAction* action)
// we create a command
XQCommand* command = new XQCommand( cmdType, this );
QModelIndex currentIndex = treeTable()->currentIndex();
command->setOriginIndex(currentIndex);
// store the row positions of the selected indices
command->saveNodes( selectionList );
command->setOriginIndex( treeTable()->currentIndex() );
// execute command
_undoStack->push( command );
}
@@ -455,7 +455,7 @@ void XQViewModel::cmdDeleteUndo( const XQCommand& command )
{
for (const auto& entry : command)
{
qDebug() << " --- delete UNDo: " << entry.contentNode->to_string();
qDebug() << " --- delete UNDo: " << entry.contentNode->friendly_name();
}
}
@@ -506,7 +506,8 @@ void XQViewModel::cmdToggleSection( const XQCommand& command )
{
const QModelIndex& index = command.originIndex();
Q_ASSERT(index.isValid());
toggleSection( _sections.sectionByRow(index.row()) );
const XQModelSection& section = _sections.sectionByRow(index.row());
toggleSection( section );
}