added some comments.
This commit is contained in:
@@ -27,12 +27,11 @@ void XQNodeStore::dumpList( const QString& title ) const
|
||||
|
||||
|
||||
XQCommand::XQCommand(CmdType cmdType, XQModel* modelView )
|
||||
: _cmdType{ cmdType }, _modelView(modelView)
|
||||
: _cmdType{ cmdType }, _model(modelView)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
XQCommand::~XQCommand()
|
||||
{
|
||||
qDebug() << " --- command destructor: " << toString();
|
||||
@@ -49,22 +48,34 @@ void XQCommand::setCommandType( XQCommand::CmdType cmdType )
|
||||
_cmdType = cmdType;
|
||||
}
|
||||
|
||||
|
||||
//! ruft 'onCommandRedo' 'meines' models auf.
|
||||
|
||||
void XQCommand::redo()
|
||||
{
|
||||
_modelView->onCommandRedo( *this );
|
||||
_model->onCommandRedo( *this );
|
||||
}
|
||||
|
||||
|
||||
//! ruft 'onCommandUndo' 'meines' models auf.
|
||||
|
||||
void XQCommand::undo()
|
||||
{
|
||||
_modelView->onCommandUndo( *this );
|
||||
_model->onCommandUndo( *this );
|
||||
}
|
||||
|
||||
|
||||
//! gibt den urpsrungs-index dieses commands zurück.
|
||||
|
||||
const QModelIndex& XQCommand::originIndex() const
|
||||
{
|
||||
return _originIndex;
|
||||
}
|
||||
|
||||
|
||||
//! merkt sich den ersten QModelIndex der von diesem command
|
||||
//! betroffenen items. zusätzlich wird der command-text erzeugt.
|
||||
|
||||
void XQCommand::setOriginIndex( const QModelIndex& origin )
|
||||
{
|
||||
QString cmdText("%1: %2 (%3)");
|
||||
@@ -78,17 +89,24 @@ void XQCommand::setOriginIndex( const QModelIndex& origin )
|
||||
}
|
||||
|
||||
|
||||
//! erzeugt aus den 'selected indices' eine liste mit der jewiligen knotenposition,
|
||||
//! der item-zeile und dem content-knoten.
|
||||
|
||||
void XQCommand::saveNodes( const QModelIndexList& list )
|
||||
{
|
||||
clear();
|
||||
// über jede zeil
|
||||
for( auto entry : list )
|
||||
{
|
||||
XQNodePtr contentNode = XQItem::xqItemFromIndex( entry ).contentNode();
|
||||
// im command speichern wir den original knoten, nicht eine kopie, wie im clipboard.
|
||||
// knoten holen
|
||||
const XQNodePtr& contentNode = XQItem::xqItemFromIndex( entry ).contentNode();
|
||||
// hier speichern wir den original knoten, nicht einen clone, wie im clipboard.
|
||||
push_back( {entry.row(), contentNode->own_pos(), contentNode } );
|
||||
}
|
||||
}
|
||||
|
||||
//! erzeugt einen string aus dem command-type, fürs debuggen.
|
||||
|
||||
QString XQCommand::toString()
|
||||
{
|
||||
|
||||
|
Reference in New Issue
Block a user