6 ms·
Can you elaborate on “recipe for tears”?
by JanisErdmanis 3y ago
Can you elaborate on “recipe for tears”?
- ognarb 3y agoNot OP, but QML is not a great language to put more logic than simple bindings and functions like Button { text: "Save" enabled: textField.text.length > 0 // this is reactive to the value of a TextField onClicked: Backend.save() } as soon as you try to for example implement the save method in JS/QML this starts to become very painful as it often ends up with a lot of spaghetti code. The very cool thing with QML is that the save function can be simply implemented in C++ like this. Backend::save() { // call QFile/QNetworkRequest/... } It force the programmer to split their logic from the UI layer which I don't consider a bad thing.
- JanisErdmanis 3y agoIt is also possible to have a backend implemented in JS in similar way. Though I personally only have used in intial UI prototype which I latter swapped with Julia backend.
- notyoutube 3y agoI'm curious about julia as a gui language: mind sharing your code/project?
- JanisErdmanis 3y agoI have developed/prototyped a voting client with QML/Julia in PeaceFounderClient [1]. Few weeks ago I made bundling setup for it and have published bundles [2]. This may not scale well but I opted for bridging the backend with frontend in top scope with Bridge.qml [3] which on the Julia side is loaded with ‘loadqml’ using ‘QML.jl’ pacakge [4]. [1]: https://github.com/PeaceFounder/PeaceFounderClient/tree/main https://github.com/PeaceFounder/PeaceFounderClient/tree/main [2]: https://github.com/PeaceFounder/PeaceFounderClient/releases https://github.com/PeaceFounder/PeaceFounderClient/releases [3]: https://github.com/PeaceFounder/PeaceFounderClient/blob/main/qml/Bridge https://github.com/PeaceFounder/PeaceFounderClient/blob/main... [4]: https://github.com/PeaceFounder/PeaceFounderClient/blob/cf9d831191475159d8280c309d9f786b91018bac/src/PeaceFounderClient.jl#L120 https://github.com/PeaceFounder/PeaceFounderClient/blob/cf9d...
- notyoutube 3y agoAnd an interesting project to boot! Thanks for sharing
- sircastor 3y agoIt was basically this - and to be clear this is not a shortcoming of QML. As you said, splitting the logic layer from the UI is a good idea - but the choice for us to be building apps in QML without a logic layer under it required a lot of weird solutions that could've been easily addressed if we'd been doing C++ and Qt. But our team were Javascript developers, the team we were partnering with were Qt devs, and someone had negotiated this solution and we did the work.
- saidinesh5 3y agoThe imperative parts of QML is javascript. So lack of type safety in larger apps can start getting really annoying, especially once the code base starts to age and not all corners of the code base gets tested every day. Other than that, beginners to the codebase tend to break property bindings without realizing. There are a few tools to catch this at runtime, but would be nice to do this at compile time. Also not all of the "Desktop widgets" were readily available in QML in Qt 5 (not sure what the status in Qt 6), and you tend to roll your own Table Views etc.. and those ones need even more work to work like native widgets, supporting keyboard navigation etc... Overall Qt5/QML was fun to work with, but I did miss a few bits that were readily available on QWidgets.
- JanisErdmanis 3y agoI agree. Lack of typing in JavaScript is a hassle.