looking better.

This commit is contained in:
2025-08-26 19:41:28 +02:00
parent 5057edb9ad
commit 6ee677c595
10 changed files with 107 additions and 129 deletions

View File

@@ -195,35 +195,10 @@ void XQViewModel::onActionTriggered(QAction* action)
}
/*
switch (command.commandType())
{
case XQCommand::cmdToggleSection:
return cmdToggleSection( command.originIndex() );
case XQCommand::cmdCut:
return cmdCut( command );
case XQCommand::cmdPaste:
return cmdPaste( command );
case XQCommand::cmdNew:
return cmdNew( command );
case XQCommand::cmdDelete:
return cmdDelete( command );
case XQCommand::cmdMove:
break;
default:
qDebug() << " --- onCommandRedo: default: not handled: " << command.toString();
}
*/
//! führt die 'redo' action des gegebenen commnds aus.
void XQViewModel::onCommandRedo( XQCommand& command )
void XQViewModel::onCommandRedo( const XQCommand& command )
{
static MemCallMap redoCalls
{
@@ -249,45 +224,10 @@ void XQViewModel::onCommandRedo( XQCommand& command )
}
}
/*
try
{
switch (command.commandType())
{
case XQCommand::cmdToggleSection:
return cmdToggleSection( command.originIndex() );
break;
// undo Cut -> perform undoCut
case XQCommand::cmdCut:
return cmdCutUndo( command );
// undo Paste -> perform Cut
case XQCommand::cmdPaste:
return cmdPasteUndo( command );
// undo Move -> perform move back
case XQCommand::cmdMove:
// not yet implemented
break;
// undo New -> perform Delete
case XQCommand::cmdNew:
cmdNewUndo( command );
break;
// undo Delete -> perform New
case XQCommand::cmdDelete:
qDebug() << " --- onCommandUndo: delete: " << command.toString();
return cmdDeleteUndo( command );
default:
qDebug() << " --- onCommandUndo: default: not handled: " << command.toString();
}
*/
//! führt die 'undo' action des gegebenen commnds aus.
void XQViewModel::onCommandUndo( XQCommand& command )
void XQViewModel::onCommandUndo( const XQCommand& command )
{
qDebug() << " --- onCommandUndo: count: " << XQNode::s_Count;
@@ -319,7 +259,7 @@ void XQViewModel::onCommandUndo( XQCommand& command )
//! markierte knoten entfernen, 'command' enthält die liste
void XQViewModel::cmdCut( XQCommand& command )
void XQViewModel::cmdCut( const XQCommand& command )
{
// wir gehen rückwärts über alle gemerkten knoten ...
for (auto it = command.rbegin(); it != command.rend(); ++it)
@@ -340,7 +280,7 @@ void XQViewModel::cmdCut( XQCommand& command )
//! entfernte knoten wieder einfügen , 'command' enthält die liste
void XQViewModel::cmdCutUndo( XQCommand& command )
void XQViewModel::cmdCutUndo( const XQCommand& command )
{
// die anfangsposition
int itmPos = command.first().itemPos;
@@ -364,7 +304,7 @@ void XQViewModel::cmdCutUndo( XQCommand& command )
//! clipboard inhalte einfügen
void XQViewModel::cmdPaste( XQCommand& command )
void XQViewModel::cmdPaste( const XQCommand& command )
{
// selection holen ...
QItemSelectionModel* selectionModel = treeTable()->selectionModel();
@@ -399,14 +339,16 @@ void XQViewModel::cmdPaste( XQCommand& command )
}
// unsere änderungen merken fürs 'undo'
command.saveNodes( selectionModel->selectedRows() );
/// fix_xx
const_cast<XQCommand&>(command).saveNodes( selectionModel->selectedRows() );
}
//! einfügen aus dem clipboard wieder rückgängig machen
void XQViewModel::cmdPasteUndo( XQCommand& command )
void XQViewModel::cmdPasteUndo( const XQCommand& command )
{
command.dumpList("Paste UNDO");
// wir gehen rückwärts über alle markieren knoten ...
@@ -427,7 +369,7 @@ void XQViewModel::cmdPasteUndo( XQCommand& command )
//! entfernen der selection ohne copy in clipboard.
void XQViewModel::cmdDelete( XQCommand& command )
void XQViewModel::cmdDelete( const XQCommand& command )
{
// wir gehen rückwärts über alle markieren knoten ...
for (auto it = command.rbegin(); it != command.rend(); ++it)
@@ -444,7 +386,7 @@ void XQViewModel::cmdDelete( XQCommand& command )
//! macht 'delete' wirder rückgängig.
void XQViewModel::cmdDeleteUndo( XQCommand& command )
void XQViewModel::cmdDeleteUndo( const XQCommand& command )
{
}
@@ -452,7 +394,7 @@ void XQViewModel::cmdDeleteUndo( XQCommand& command )
//! legt eine neue, leere zeile an.
void XQViewModel::cmdNew( XQCommand& command )
void XQViewModel::cmdNew( const XQCommand& command )
{
// __fix
@@ -488,14 +430,14 @@ void XQViewModel::cmdNew( XQCommand& command )
//! entfernt die neu angelegte zeile.
void XQViewModel::cmdNewUndo( XQCommand& command )
void XQViewModel::cmdNewUndo( const XQCommand& command )
{
}
//! schaltet eine section sichtbar oder unsichtbar.
void XQViewModel::cmdToggleSection( XQCommand& command )
void XQViewModel::cmdToggleSection( const XQCommand& command )
{
const QModelIndex& index = command.originIndex();
Q_ASSERT(index.isValid());