mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
desktop: move undo-disabling from enterEditState to disableShortcuts
When entering the edit state, we don't want the user to be able to undo/redo lest things become inconsistent. Since the only way to enter edit state is to edit the profile, we can simply use the disableShortcuts() function that is used by the profile when it goes into edit state. This has one desirable side-effect: Undo is now also disabled in the planner. Undo during planning likewise can lead to inconsistent state. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
fe926d35f4
commit
3965ae2c89
1 changed files with 4 additions and 4 deletions
|
@ -710,6 +710,8 @@ void MainWindow::on_actionPrint_triggered()
|
|||
|
||||
void MainWindow::disableShortcuts(bool disablePaste)
|
||||
{
|
||||
undoAction->setEnabled(false);
|
||||
redoAction->setEnabled(false);
|
||||
ui.actionPreviousDC->setShortcut(QKeySequence());
|
||||
ui.actionNextDC->setShortcut(QKeySequence());
|
||||
ui.copy->setShortcut(QKeySequence());
|
||||
|
@ -719,6 +721,8 @@ void MainWindow::disableShortcuts(bool disablePaste)
|
|||
|
||||
void MainWindow::enableShortcuts()
|
||||
{
|
||||
undoAction->setEnabled(true);
|
||||
redoAction->setEnabled(true);
|
||||
ui.actionPreviousDC->setShortcut(Qt::Key_Left);
|
||||
ui.actionNextDC->setShortcut(Qt::Key_Right);
|
||||
ui.copy->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
|
||||
|
@ -1090,8 +1094,6 @@ void MainWindow::on_actionViewAll_triggered()
|
|||
|
||||
void MainWindow::enterEditState()
|
||||
{
|
||||
undoAction->setEnabled(false);
|
||||
redoAction->setEnabled(false);
|
||||
stateBeforeEdit = state;
|
||||
if (state == VIEWALL || state == INFO_MAXIMIZED)
|
||||
return;
|
||||
|
@ -1115,8 +1117,6 @@ void MainWindow::enterEditState()
|
|||
|
||||
void MainWindow::exitEditState()
|
||||
{
|
||||
undoAction->setEnabled(true);
|
||||
redoAction->setEnabled(true);
|
||||
if (stateBeforeEdit == state)
|
||||
return;
|
||||
enterState(stateBeforeEdit);
|
||||
|
|
Loading…
Add table
Reference in a new issue