mobile: fix undo/redo

The signals of the undo-stack can only be connected after it
was initialized. One of those cases where I would have preferred
a crash over a warning message. The mobile version is extremely
noisy!

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-03-30 22:31:40 +01:00 committed by bstoeger
parent 83fa38b3b4
commit 916c88ded9

View file

@ -321,10 +321,6 @@ QMLManager::QMLManager() :
if (verbose)
connect(&diveListNotifier, &DiveListNotifier::divesChanged, this, &QMLManager::divesChanged);
// get updates to the undo/redo texts
connect(Command::getUndoStack(), &QUndoStack::undoTextChanged, this, &QMLManager::undoTextChanged);
connect(Command::getUndoStack(), &QUndoStack::redoTextChanged, this, &QMLManager::redoTextChanged);
// now that everything is setup, connect the application changed signal
connect(qobject_cast<QApplication *>(QApplication::instance()), &QApplication::applicationStateChanged, this, &QMLManager::applicationStateChanged);
@ -334,6 +330,10 @@ QMLManager::QMLManager() :
// setup Command infrastructure
Command::init();
undoAction = Command::undoAction(this);
// get updates to the undo/redo texts
connect(Command::getUndoStack(), &QUndoStack::undoTextChanged, this, &QMLManager::undoTextChanged);
connect(Command::getUndoStack(), &QUndoStack::redoTextChanged, this, &QMLManager::redoTextChanged);
}
void QMLManager::applicationStateChanged(Qt::ApplicationState state)