mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Undo: make editing of dive number undoable
When pressing F2 in the dive list, the number can be edited. Make this action undoable by implementing a EditNumber command. This command is differs from the other undo commands, as not the currently selected dives are changed. This means that the EditCommand needs an alternative constructor taking a single dive. This constructor was implemented in the base class so that all edit commands can now be called with a single dive. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
658ac2bb78
commit
726d08c2f7
5 changed files with 55 additions and 2 deletions
|
@ -7,6 +7,7 @@
|
|||
#include "core/qthelper.h"
|
||||
#include "core/subsurface-string.h"
|
||||
#include "core/tag.h"
|
||||
#include "desktop-widgets/command.h"
|
||||
#include <QIcon>
|
||||
#include <QDebug>
|
||||
#include <memory>
|
||||
|
@ -412,8 +413,7 @@ bool DiveTripModelBase::setData(const QModelIndex &index, const QVariant &value,
|
|||
if (dive->number == v)
|
||||
return false;
|
||||
}
|
||||
d->number = v;
|
||||
mark_divelist_changed(true);
|
||||
Command::editNumber(v, d);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue