White-Oak / qml-rust

QML (Qt Quick) bindings for Rust language
MIT License
205 stars 18 forks source link

Decoupling UI from application core #20

Closed avitex closed 6 years ago

avitex commented 7 years ago

First off, thank you for the library :)

Toying around with the idea of using this library in a project, however I am at a loss on how I should decouple the UI from the application logic. I plan to create a core library that's frontend agnostic, so it can be embedded in other applications, or just have it's frontend switched.

The application core will have external events that it handle in it's own event loop, which creates the problem I currently have; connecting them and notifying state changes to the UI.

Qt supports dispatching custom events, however from what I can see, DOtherSide doesn't support this functionality and it would most probably be quite a bit of work to implement. So with that in mind, I've been thinking if there are any alternatives.

One alternative I haven't tested, would be potentially creating spinning channel listeners in QObject.threaded, and applying the state updates there, however I'm not sure if I am shoehorning with this design.

What do you think?