From 916c88ded9be21806972f3d8e1b6a34bb5429f9c Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 30 Mar 2024 22:31:40 +0100 Subject: [PATCH] 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 --- mobile-widgets/qmlmanager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 98531c747..0ec2f2112 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -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::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)