39 void submit(Watched&& watched, Args&&... args)
41 using decayed = std::remove_cvref_t<Watched>;
42 if constexpr(std::is_pointer_v<decayed>)
44 static_assert(std::is_base_of_v<QObject, std::remove_cvref_t<
decltype(*watched)>>);
49 static_assert(std::is_base_of_v<QObject, decayed>);
55 stack().disableActions();
56 m_cmd = std::make_unique<TheCommand>(watched, std::forward<Args>(args)...);
57 m_cmd->redo(stack().context());
61 if(m_cmd->key() != TheCommand::static_key())
63 throw std::runtime_error(
64 "Ongoing command mismatch: current command " + m_cmd->key().toString()
65 +
" does not match new command " + TheCommand{}.key().toString());
68 safe_cast<TheCommand*>(m_cmd.get())->update(watched, std::forward<Args>(args)...);
69 m_cmd->redo(stack().context());