Recently, deepin DTK (Development ToolKit) has been formally adapted to Qt6 (6.4.2), realizing a comprehensive upgrade.
DTK, as a set of simple and practical general development framework developed by deepin based on Qt, is at the core of deepin OS. The successful adaptation means that deepin OS will make full use of the new features and functions of the Qt6 version to provide users with a more advanced and efficient experience to the greatest extent possible.
Why Adapt Qt6
Since the birth of deepin, deepin desktop OS has attracted wide attention for its simple, intuitive and beautiful appearance, as well as its unique operation. dtk, as the core tool development component of deepin OS, not only provides users with a rich set of controls, but also has strong customization capability and high scalability, which injects a unique personality and charm into the deepin desktop OS. As the core tool development component of deepin operating system, it not only provides users with rich controls, but also has strong customization ability and high extensibility, which injects unique personality and charm into deepin desktop operating system. Therefore, the deepin team has been keeping an eye on the changes of Qt.
Qt6, as the latest version of the SDK we are using, is not only an upgrade of Qt5, but also a complete overhaul from the ground up, which not only strengthens cross-platform compatibility and improves performance, but also introduces a lot of new features and tools, such as more powerful graphic rendering, multi-threading support, etc. Qt6 will be the future of the deepin desktop operating system.
Considering that Qt6 is going to be the major version in the next few years, in order to make sure that the application will keep up with the latest technology in the future development, we have finished adapting the DTK to Qt6(6.4.2) in deepin V23 Beta version.
After adapting Qt6, developers can directly access DTK on projects developed based on Qt6, without having to separately adapt Qt5 & DTK, which greatly reduces the duplication and waste of development resources. Applications already developed in Qt6 can also access the DTK framework for in-depth development of more DDE-compliant programs, taking into account both performance and aesthetics.
Adaptation Issues and Handling
- API Changes
Qt6 has made some major changes and adjustments to some APIs, resulting in some original code needing to be modified and adapted. So we analyzed and refactored the code to ensure its compatibility with Qt6 and Qt5.
- Missing Features
In Qt6, due to technical and architectural changes, some features that existed in Qt5 may have been removed, replaced, or (temporarily) disabled. This means that we need to find alternative ways to implement the same functionality, or redesign and develop the functionality in question.
- Third-party library and plugin compatibility
Qt5 often integrates with other third-party libraries and plugins that may not be fully compatible with Qt6, so we have evaluated and tested these integrations and made the necessary changes and adjustments when adapting to Qt6. For example, qtxdg/QGSettings has not been fully adapted to Qt6 yet, so libqtxdg/QGSettings related code is temporarily disabled during Qt6 compilation.
- Updating dependencies
Qt6 usually upgrades some of the external libraries and toolchains it depends on in order to meet the requirements of Qt6. It is a good idea to upgrade and adapt these dependencies.
- DTK6's Packaging and Versioning Implementation
After DTK has adapted Qt6, we don't create a new branch to manage DTK5 and DTK6 for the sake of maintainability, they use the same set of code, and DTK5 and DTK6 will coexist in the system.
- Interface Adaptation
For interfaces in Qt5 that have been marked as deprecated but are still in use, when adapting to Qt6, we directly remove them and replace them with available interfaces. For some unstable interfaces, such as some Qt private interfaces or even private variables obtained by certain techniques, we compare the source code of Qt5 and Qt6 versions, find the changed interfaces according to the functional logic, and try to replace them with the interfaces that are publicly available in Qt6.
Results and Future Plans
During the whole Qt6 adaptation process, there were 1000+ (1609) file changes, 20000+ lines of code added and 10000+ lines of code removed.
Up to now, deepin DTK has completed 5 version iterations, 100+ updates, nearly 200,000 lines of committed code, and has been migrated to more than 10 Linux distributions.
In the future, we will keep pace with the latest technology to further improve the stability of the application. We sincerely hope that this adaptation will bring developers and users a more advanced and efficient experience, and we look forward to more interested parties joining us to discuss more content and contribute to the development of the ecosystem.