QmlComms Module

I wrote a chat client!


It sucks, don’t use it.

Of course I didn’t make it for actual use. I made it as a quick example of a QML module I wrote. It’s really easy to hook up your C++ code to QML for serious applications, I’m sure no-one denies that by now. But the other big strength of QML is rapid prototyping, and for this stage you often don’t want to expend even the minimal effort of adding some C++ code. Or perhaps you’re restricted to just the QML for other reasons, like you’re a UI designer preparing a mock-up and not the backend code. I love using QML like this all the time, but I’ve frequently run into a stumbling block – networking. When I want to prototype a networking app I’ve got to touch C++, and then it just doesn’t feel like rapid prototyping anymore. This is what this QML module provides, a prototype level of networking support. Send messages across the wire to your QML application on another machine! As an aid to prototyping, it has the following features:

  • Dead simple API (at least, as simple as networking can be)
  • Naive implementation
  • No security

Note: I hope to add bluetooth support sometime, because a lot of prototyping I do is from mobile device to mobile device. But for most native software prototypes you don’t *want* it connected to the world wide web anyways so the mandate focuses on LAN use only.

For me, this was also just another example of how easy Qt and QML are. This time the main kudos actually go to the Qt Networking stack; it was dead simple to write, test and ‘deploy’ (compile and run on another machine) the plugin and the example. I was actually about to go to bed, then I thought I might just squeeze this module out first. I was very plesantly suprised when it actually fit into that timeframe! Even the bonus feature of the forwarding property, which wasn’t key to the module’s basic functionality but merely made the chat app more impressive at minimal cost.

Leave a Reply

Your email address will not be published. Required fields are marked *