Introducing Generative AI in Qt

Will Generative Artificial Intelligence change how we develop Qt applications? We asked ourselves this question, and instead of thinking about it too long, we decided to make it happen. We implemented a Github Copilot integration in Qt Creator 11 as a Technical Preview.

How does Generative AI work in Qt Creator?

We have seen it so often that developers get tired of programming repetitive code, creating endless test cases, and searching online for code suggestions.

The GitHub Copilot integration makes developers more effective when writing code, allowing them to focus on the business logic instead of reinventing the wheel.

GitHub Copilot suggests lines of code, complete functions, and test cases in the editor of the Qt Creator. GitHub Copilot offers new code “based on the project's context and style conventions.” Developers can apply suggestions as a whole or only parts of them.

GitHub Copilot in Qt Creator

Screen capture of Test Case Suggestion by GitHub Copilot in Qt Creator editor window

GitHub Copilot is a commercial AI code assistant tool. You can try it out for 30 days free of charge, after which it is at least $10 per month for individuals or $19 per month for an Enterprise license at the time of writing this post.

Increasing productivity with Augmented Intelligence

The GitHub Copilot integration is the first AI functionality readily integrated by the Qt Company in Qt’s developer tools. Whatever we will do in the future in Artificial Intelligence will follow our mission of optimizing productivity in the entire product development process. We want to supercharge innovations. We want to turn ideas into software. More importantly, we want you to see us as a partner for your creativity. AI might mean for us Augmented Intelligence rather than purely Artificial Intelligence.

Qt will focus on Augmented Intelligence, which supports you as a virtual buddy rather than trying to replace you.

The GitHub Copilot is an excellent example of this intent. Github Copilot makes suggestions that you can take over, modify, or simply ignore (in that way, it's even better than a human colleague because you don’t need to be polite in your rejections). 

Considerations on using Generative AI


The integration of GitHub Copilot is a technological and a commercial challenge. Obviously, GitHub Copilot is a third-party service, admittedly a great one, but that means it comes with an additional set of terms and conditions which are not under the control of The Qt Company. The terms and conditions for Generative AI are tricky. Firstly, the laws and ethics around augmented code generation are still evolving. There are no commonly accepted rules. Secondly, whether the terms and conditions for Generative AI providers are acceptable depends on how you judge the rights of the sources used in training the algorithms.

Cheating Illustration

Is Generative AI only an automated way to launder non-permissive open source code? What level of minor justifications makes a “copy” of non-permissive, non-copyleft code, such as under General Public License (GPL) terms, acceptable as new IPR? Is the change of a variable name or a different declaration of a variable enough? It won't be considered enough change if a human manually modifies it. So why would it be okay if done by Generative AI? The product-specific terms and conditions of GitHub Copilot shift the responsibility for using any suggestions to you. The Qt Company can and will not take any responsibility for suggestions as GitHub Copilot serves us information in a black box method. Interestingly, GitHub is not interested in an IPR violation if the user has not activated "all filtering features available." At the time of writing, the filters not to use non-permissive, public open source software are deactivated by default.

We at Qt recommend carefully evaluating the terms and conditions related to using any Generative AI, both for open source and commercial use.

We do recommend turning on the filters and screening for suggestions from non-permissive open source code before using the service. Playing around with GitHub Copilot might be fun without the filters being activated momentarily. Still, we recommend, just like GitHub does indirectly in the terms and conditions, to only create product code with all filters applied. Don’t get us wrong: We at Qt love it when adopting a new programming language is easier, and productivity is higher with smart suggestions. However, we don't want it to be done at the expense of intellectual property. In case of doubt, do not use a particular suggestion from Generative AI or try to use some of the millions of lines of QML and C++ code of the Qt framework software libraries, which can be fully commercially supported with a license.

Furthermore, we recommend not allowing GitHub Copilot to use snippets or suggestions for your code to be used to train the AI algorithm. That might be the strongest, yet not perfect, way to prevent you see your code with a small modification being suggested to somebody else.

AI Coding Illustration

GitHub Copilot integration to Qt in Technical Preview


If you want to try it for yourself already, at your own risk as usual, even before Qt Creator 11 is done, then you can download the latest Qt Creator snapshot from us. You need a GitHub Copilot subscription to use it. You need to download some files and place them in the required folders according to the README text. You can activate GitHub Copilot across all Qt Creator or only project-specific. Remember to activate all filters in the GitHub Copilot settings. The target is to release Qt Creator 11 at the end of July.

As mentioned before, we are providing the GitHub Copilot integration as Technical Preview to collect feedback from you, the users of the Qt Creator. What use cases of generative AI would you like to see from Qt in the future? Would you like us to release the GitHub Copilot integration as a feature instead of Technical Preview? Would you rather see us integrating Codeium to use only permissive code to train the algorithm? Or would you instead want the Qt community to develop its own Language Learning Model (LLM) to be used directly with OpenAI? Let us know. For example, you can drop your suggestions in the comments below.


Blog Topics:

Comments