From 17cdcdf68256b18aa78717c4c666fb025e103dc5 Mon Sep 17 00:00:00 2001 From: Reinder Feenstra Date: Tue, 18 May 2021 23:56:52 +0200 Subject: [PATCH] fix: make sure checked state of stop/run matches world state due to the toggle feature, its checked state changes, but we need to wait for a world state change --- client/src/mainwindow.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client/src/mainwindow.cpp b/client/src/mainwindow.cpp index 6ec8e0a7..526aebb4 100644 --- a/client/src/mainwindow.cpp +++ b/client/src/mainwindow.cpp @@ -146,14 +146,22 @@ MainWindow::MainWindow(QWidget* parent) : [this]() { if(Q_LIKELY(m_world)) + { m_world->callMethod("stop"); + if(AbstractProperty* p = m_world->getProperty("state")) + m_worldStopAction->setChecked(!contains(p->toSet(), WorldState::Run)); // make sure checked matches current world state + } }); m_worldStopAction->setCheckable(true); m_worldRunAction = m_menuWorld->addAction(QIcon(":/dark/run.svg"), Locale::tr("world:run"), [this]() { if(Q_LIKELY(m_world)) + { m_world->callMethod("run"); + if(AbstractProperty* p = m_world->getProperty("state")) + m_worldRunAction->setChecked(contains(p->toSet(), WorldState::Run)); // make sure checked matches current world state + } }); m_worldRunAction->setCheckable(true); m_menuWorld->addSeparator();