[Interest] synchronous use of Qt state machine

Stefan Seefeld stefan at seefeld.name
Thu Feb 2 20:27:18 CET 2023


I haven't got any response to my question, but as the answer may really
help us simplify our code I'm sending it again.
Thanks for any help !

On Tue, Nov 22, 2022 at 9:02 AM Stefan Seefeld <stefan at seefeld.name> wrote:

> Hello,
> we are using Qt State Machines in a number of places in our applications
> to manage object states for certain types of objects. Occasionally I would
> like to use and manipulate such objects in a non-event-driven context, i.e.
> without a running event loop.
> Short of a StateMachine function that allows me to wait for outstanding
> transitions to be completed, I wrote a little helper function that
> instantiates a `QEventLoop`, then calls
> `processEvents(QEventLoop::ExcludeUserInputEvents)` to drain the event
> queue and thus make sure that all in-flight transitions have been completed.
> While this appears to be working fine, I'm not sure this is the best way
> (or at the very least, a particularly elegant way) to achieve what I want.
> Is the above a "correct" way to get what I want ? Is there a better way ?


      ...ich hab' noch einen Koffer in Berlin...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20230202/e8597387/attachment.htm>

More information about the Interest mailing list