Qt Contribution Guidelines
We have a community around the development of the Qt libraries, Qt related tools and add-ons called the Qt Project. These guidelines will introduce you to the tools and mechanics as well as to the philosophies behind the development of Qt. You will learn how to set up your development environment for working on the library itself and how to submit code/documentation for inclusion.
Creating Changes for Inclusion Into Qt
When you intend to make changes, you need git clones configured for use with Gerrit. This mostly supersedes the more user-oriented instructions for getting the Qt source code and setting up your local working environment to build Qt.
The Gerrit tutorial describes in detail how our version of Gerrit works for the Qt Project. Here is the short version.
There are some steps you need to follow only once:
- Create a Qt account. This login is used by both the JIRA bug tracker and the Gerrit code review system.
- Set up the Gerrit account. Even though the account credentials are shared, you still need to complete the account details in Gerrit.
- Get the Qt source code and make sure you can build it.
- When you run the init-repository script, provide your Gerrit username to the --codereview-username option and specify -developer-build
Then there are steps you need to follow for each patch you contribute:
- Make your change(s) to a local branch. Example:
- git checkout -b my-fix origin/5.6
- See Branch Guidelines for details on selecting the correct branch to develop from
- ... make changes ...
- git commit -a
- Each commit should have only one self-contained change. Modify existing commits by using the --amend switch when committing.
- The Commit Policy contains relevant information.
- git checkout -b my-fix origin/5.6
- Push your change(s) via the git-gpush script
- Example: git gpush --branch <BRANCH>
- The Early Warning System (EWS) will quickly kick in and check your patch. Please act upon the reports and push updates to the patch.
- Add relevant reviewers to your change(s). If you don't do this, your change may go unnoticed. To find possible reviewers, you can:
- Wait for reviews, and actively partake in the review of your change(s).
- If your contribution is deemed to not align with the project's vision or goals, you should abandon the change at this point.
- If your contribution is deemed unready, you need to fix it up according to the reviews. Note that the process is very different from GitHub.
- Once approved, integrate your patch. Depending on the particular branch's and/or repository's configuration, you either stage the change for integration, or you directly submit it to the target branch.
- Usually, you are responsible for the integration of your own changes. The reviewers will do that only in exceptional cases.
- If the continuous integration (CI) system rejects your patch, you need to fix the issues so it passes the project's build and autotest systems.
- The CI often fails for reasons unrelated to a particular patch. Make sure to re-stage the change when the integration log indicates such a case.
- When CI is successful, your changes are automatically included into the official Qt repository.
See Gerrit Caveats and Hints to avoid common traps.
See Building Qt 5 from Git for a full description of how to clone, configure and build Qt5 from git on different platforms. Though that page repeats a few topics mentioned on the current one, it focuses more on details around building Qt.
When you start an entirely new project or import an existing one from elsewhere, you need to request a new repository.
A Shortcut ...
If you have only a minor contribution to make and find the process out of proportion for that, you may simply attach a patch to a bug report. However, the more of the necessary steps you defer to the code's maintainers, the less likely is your contribution to be integrated in a timely manner.
Style, Conventions and Principles
For development of the Qt framework we follow the framework's Qt Coding Style and we stick to our established Coding Conventions. The KDE Library Code Policy is based on Qt's, so much is shared with Qt's. You can find more information there that isn't in Qt pages.
Qt Creator uses its own Qt Creator Specific Coding Style & Conventions. It is similar to the Qt framework's coding style and conventions, but there are some differences and additions.
In addition, conventions for writing good user interface messages texts that play well with Qt Linguist can be found under UI Text Conventions.
Our API Design Principles aim for perfection.
Note that Qt is an open source library, and must therefore be compilable in its completeness using freely available tools and libraries. This means that you should not contribute code that uses any kind of private APIs.
Please follow the Commit Policy.
Verify that your commits have correct author information, including your name and email address as it is registered in Gerrit.
Localization to Other Languages
The process of contributing translations is described in Qt Localization.
If you have any questions about the development of Qt, feel free to join the #qt-labs IRC channel on irc.freenode.net and the Qt development mailing list. For questions relating to Qt Creator development, join #qt-creator on irc.freenode.net and the Qt Creator mailing list.
For a full list of IRC channels of interest to Qt developers, Online Communities.