Why should you be writing your first Qt QML application right away?
Java and Kotlin for Android, Python and R for Statistics and JavaScript for Web. That’s a lot of mess out there. Although JavaScript makes it a lot simpler to have cross platform and multi-environment development (TensorFlow like libraries are readily available for JavaScript and getting better), developing GUI remains a cumbersome task using JavaScript modules for desktop and mobile, besides React.js seems so promising.
With the power of a JavaScript engine, immense Qt library being handy and availability of bindings for almost all the languages* out there, Qt QML is by far one of the best GUI development Frameworks out there. It is not just a language but an environment boosted with an ample number of modules for almost any job. Apart from all these highlighting features, here are some reasons why new developers should learn building with this open source technology.
Write once, deploy anywhere
After continuing learning and developing with Qt and QML for over 3.5 years, I have become quite fond of this development framework. Whatever you can develop using 3 languages in 3 different environments, you can achieve it with a single language for multiple platforms. That’s not something new in the market.
Xamarin, an offering from the developers of Mono — an open source .NET alternative, provides runtime to develop cross platform applications for Windows, macOS, Linux and iOS, Android. The good part is, it’s open source and backed by Microsoft (as of 2016) while poor graphics libraries are its only downside.
React is the way to go for any new developers looking into web development as well as Android and iOS. Being a JavaScript framework and supported by Facebook, the only downside is, the library is quite new and is prone to heavy memory usage and inconsistent library support across platforms.
Flutter, written in Dart is another contender with similar usage as that of React but backed by the promise of Google. Dart is not a very popular programming language and so is the dearth of support for the framework from the online community.
NativeScript, Cordova, Ionic are some of the less popular honorable mentions.
The Qt5/6 Framework is available for Windows, Linux, macOS, Android, iOS and embedded platforms as well. I don’t need to mention this but Qt is the most mature project in all of these above-mentioned list of frameworks as it has been there in the market since 1991 and growing. It even receives codes from the KDE community apart from the main development team. The QML project was started in 2009 on top of a custom JavaScript V4 engine and has since seen adoption from some big names including Blackberry, Canonical and KDE itself.
Custom Look and Feel
The only concern with QML is that the default UI doesn’t look quite Native to the platform. In the case of Linux environments, especially a DE other than KDE Plasma, Qt apps don’t integrate well. But it’s on developers to adapt to a more friendly UI for their QML app. Well, that can be considered as an added advantage.
QML provides a very rich set of themes for every platform that it supports. Along with the default style, which actually separates Qt apps’ look from other native apps, it supports Fusion and Imagine theme styles. Both of which are wonderful styles with very less resource consumption. On the other hand, developers opting for more modern style can choose the Google Material theme or even Microsoft Universal style. While these 2 themes are essentially eye candies, they consume more resources than the earlier two mentions.
On the other hand, a developer can make its own themes as convenient. Here is one of my own project where custom styles were used very heavily — Icefish Explorer.
Less lines overall
Let’s see some coding examples…
Go check for yourself the number of lines of codes that you will be writing in both the cases.
Simple Syntax and Direct Learning curve
//it places an image centered inside blue colored Rectangle
import QtQuick 2.15
Rectangle {
id: canvas
width: 240
height: 480
color: "aliceblue"
Image {
id: logo
source: "logo.png"
anchors.centerIn: parent
x: canvas.height / 5
}
}
If you are already familiar with C/C++ or JavaScript, it wouldn’t take you long to get habitual to working with QML. QML is a declarative language, meaning that you just need to describe what needs to be done, the Qt Quick engine takes care of how it needs to be done. The simple Signal and Slot mechanism accompanied by QML’s Connection module makes integration between C++ and QML code far simpler. Integrating codes written in JavaScript can directly be called from QML context since Qt Quick itself is executed by a JavaScript engine.
States, Property Bindings and Animations
To modify the properties of any QML component, you can simply bind them with states and call them when a particular event is triggered, like a Mouse Click event. Furthermore, you are not limited to just static components but with the help of Animations modules present in Qt Quick, you can create a nice looking UI just within minutes. Since QML is declarative, Animations require only property definitions to work instead of defining the whole process.
Great Documentation
Who says only Microsoft makes great documentation. Just look at Qt documentation for its QML components and you will have a hard time figuring what’s not covered there. The simple examples that come bundled with every installation of Qt in your system are self explanatory to start you off.
Works with Python too!
There’s a separate project called PyQt which has been porting Qt QML and the native C++ bindings to Python for a long time. Since there were licensing issues with Qt for Python, the official Qt Company started their own port for Python named PySide. Both the competing projects, PyQt and PySide, are in fact mature and ready to be used for great GUI apps however, the support for Android remains debatable.
Great community support
Over 100K questions asked on Stackoverflow and over 500K questions asked on Qt forum alone, Qt has got quite good adoption from the community worldwide. The community is spread over subReddits and Telegram channels as well.
Native Compilation
Since most of the code for QML back-end is in C++, the code compiles natively on most of the platforms that Qt supports. Qt (and QML) has always supported the idea of native compilation as against running the code in a Virtual machine to support cross development.
Mature and Stable
As mentioned already, Qt is a more mature project than any cross platform application development framework that you will find on GitHub. Even QML has been in active development since 2009 and attracted a lot of industry attention. That said, you will not be left behind while you work with Qt QML.
Open source and Industry support
KDE Plasma, Deepin Desktop, Unity and LXQt are some of the great open source complete desktop environments that are available for Linux and built with Qt QML parts. Blackberry 10, Plasma Mobile, Sailfish OS are some of the embedded and mobile projects that use Qt QML. Bitcoin Core is written with Qt though it doesn’t use QML but instead the old QWidgets. AMD, Microsoft, Google, Adobe, Samsung like companies use Qt in their work environments.
High paying Jobs
Qt QML and Qt C++ developers are paid anywhere between ₹400K to ₹900K in Indian metropolitan areas in companies like Capgemini and HCL Tech. In the USA, the salaries can go upto $ 90,000 per Annum. That said, Qt is high in demand.
Verdict
The only downside to using Qt QML is its licensing schemes. Things have changed in the past few years but still, if your project is not open source and you still want to distribute it commercially, you have to get the Commercial license from the Qt Company.
About 4 years back, when I first started learning QML, I was overwhelmed with the great support that the framework had as against some of the lesser known but competing standards like GTK at the time. Qt has shown that the demand for the technology isn’t dropping anytime soon and the project will continue to grow. You can spend only a few hours to learn this tech and be assured, it will be worth it.
Thank you for reading!
Have a great day.