| This is really interesting. I use meteor for the web, but am frustrated with mobile html5 client clunkiness. If i understand:
- your UI is written in QML.
- you are using Asteroid to turn DDP protocol messages into JS events?
- are you then reactively changing the QML markup and asking QT to re-render your UI? I'm interested how this part works. How granular is the reactive rendering, ie the whole page every update, or just changed components (like reactjs DOM diffing)? Have you dealt with other client side things like routing and page changes, or is it currently content for QML widgets? How far does QML allow native widgets like tab controls? Does a QML app end up just as janky as html5? Did you look at just having a QT application that would talk DDP? I guess QML looks like json/markup so it's more appealing for porting an existing meteor app, and it's markup rather than code, but some mapping to QT would presumably give much more control? How do you deal with client side logic? If QML is just a layout descriptor markup, if you need actual logic client side, how do you bridge between that and the meteor backend? I see Asteroid allows you to send data back and call Meteor.methods.
Oh I see QML actually anticipates modules in JS:
http://doc.qt.io/qt-5/qtquick-tutorials-samegame-samegame3-e...
http://doc.qt.io/qt-5/qtqml-modules-topic.html Does QML support a webview component? In which case you could also mix in some pages just as webviews if you didn't want to rewrite your whole app in QML? Then again only attractive if the QT webview component uses latest chrome renderer at an OS level, and no JS bridge was required back to your app... that would be like a turducken anti-pattern. Overall very interesting, thanks for sharing! |
In the example, I'm using models (think MVC) and updating that model, which then automagically updates the UI.
I'm not (yet) pushing the QML via Meteor, but that is the next logical step. Should the UI change (say, radioboxes instead of checkboxes), the plan is to do a diff and change altered components (this should be doable as QML's format is still close enough to JSON).
QML already has a decent set of controls (http://doc.qt.io/qt-5/qtquickcontrols-index.html) but I'm working on wrapping native components so there is full coverage of ALL components (this was actually one of my previous posts http://achipa.blogspot.com/2014/11/qml-wrappers-for-native-a...)
Of course, you could write a C++ DDP lib (and on the long run, probably should, merely for the performance boost), but asteroid and JS just made a proof-of-concept that much easier to build.
QML is not just a layout descriptor - you can embed javascript in it. Think about QML as HTML written in JSON, but without the HTML implied semantics.
Still, JS could also be shuttled accross the DDP connection, and could be run or changed client-side, there is no difference between those and QML as I mentioned above, though this is also something planned-but-not-implemented-yet.
And finally - yes, QML has a webview component(http://doc-snapshot.qt-project.org/qt5-5.4/qtwebengine-qmlmo...)