Qt 5.2 - Foundation for KDE Frameworks 5
On December 12th, the Qt Project released Qt 5.2. Congratulations to the Qt community for this great milestone! This version will form the foundation of Frameworks 5, the upcoming modularized release of the KDE libraries. As part of the Frameworks efforts, KDE devoted considerable effort to integrating valuable KDE technologies into Qt 5.2. This article is intended to give a glimpse at some of KDE's contributions to Qt.
Open Governance
Contributing to a Free and Open Source Software (FOSS) project is easier when a transparent, open governance model is in place. The Qt community was introduced to Open Governance a little over two years ago. Members of the KDE community were heavily involved in the Open Governance development, contributing their experience from KDE and other open source communities. As statistics show, 20% to 50% of the contributions to the Qt codebase comes from community, companies and individuals, showing that Open Governance is successful.Code Development
The KDE Libraries have developed during more than 15 years of work on a wide variety of KDE applications. Sometimes the functionality was an addition to existing Qt classes, other times new libraries were developed for functions such as hardware discovery (Solid) or file access (KIO). As a precursor to the plans of splitting these many libraries into easy reusable components (the work behind Frameworks 5), the libraries were vetted for code suitable for inclusion in Qt. The goal of this effort was to decrease the complexity of dependencies in Frameworks. For example, by adding timezone support to QDateTime, many core (especially Personal Information Management-related) libraries could depend directly on Qt instead of also needing the KDE localization libraries.Contributions
The code contributions from KDE to Qt varies from small fixes to Qt 5.0's entire MIME type system. Due to the history of much of this code as well as the overlap between KDE and Qt developers, most of these contributions were collaborative. During the process of upstreaming from KDE to Qt, parts of the code were rewritten, new tests and documentation were added, and the code was generally refined. Some code was inspired by minor KDE requests; some Qt classes were taken directly from KDE libraries. Improvement examples:- Most advanced CUPS features from KPrintDialog were added to QPrintDialog by Martin Klapetek and Rohan Garg, and were approved by Qt Print maintainer and KDE member John Layt. These include Odd/Even Pages, Multiple Pages Per Sheet, Server-Side Page Selection, Banner Pages and Print Job Scheduling.
- Many things KDE applications used to do via KGlobalSettings and KStyle were upstreamed into QStyle and Qt's platform plugin system, which means that pure-Qt QWidget apps now integrate a lot better with KDE and other target platforms.
- The Frameworks team upstreamed dozens of widget features from the kdeui library into Qt, including, for example, title support for QMenu, clear buttons in QLineEdit, URL drops in QComboBox, place holder texts in QTextEdit, a new static method in QInputDialog called getMultiLineText(). QColorDialog has a button for scanning the screen colors and picking them up. In addition, it got a new QLineEdit that shows the selected color in hexadecimal. These new features that are so useful for graphics program developers were in the KColorDialog and were reviewed and contributed to Qt by David Gil in order to deprecate the library in KDE.
- QtQuickControls, the eventual successor of QtWidgets, has gotten improvements in styling and drawing.
- A major feature added was time zone support in QDateTime, a much-requested feature since Qt 1 days. This is very important to KDE as it means there is no longer a need for a separate implementation of KDateTime, KTimeZone, KLocale date parsing/formatting, and other date widgets. This frees many of KDE core and PIM libraries from depending on any other KDE libraries and allows them to depend only on Qt itself; it also makes them far more useful to Qt developers.
- Another significant localization feature contributed by KDE was the new QCollator class implemented by Aleix Pol Gonzalez. This new class finally adds locale-aware sorting support to Qt, a feature used by KDE applications such as Dolphin and now available to all Qt developers.
- KStandardDirs APIs were upstreamed by adding and extending QStandardPaths, which allows application authors to deal more easily with standard locations on various desktop platforms.
- KDE contributors wrote Qt 5.0's MIME type system.
- The Qt shortcut system was edited by David Edmundson so that shortcuts are now fetched from the underlying platform. As a result, all KDE Qt applications will now follow the user-configured shortcuts from within KDE Plasma Workspaces.
- KDE contributors helped resurrect X11 session management handling in Qt 5, which had been lost during the transition to QPA.
- Frameworks developers added QCommandLineParser, a frequently requested feature in Qt: parsing application-defined command-line arguments.
- The QFontDatabase::systemFont API makes it possible to query the QPlatformTheme (or the OS) about the standard system fonts for different uses and give a QPlatformTheme the ability to provide a Monospace font.
Conclusion
KDE code upstreaming is ongoing, with a variety of improvements planned for Qt 5.3 and further. These code contributions are closely scrutinized to ensure quality and applicability to the Qt community beyond KDE. A Qt library archive is available to all Qt toolkit users. The goal of this archive, called Inqlude, is to provide a comprehensive listing of all existing libraries for developers of Qt applications.The KDE Community is committed to Qt quality, extensive capabilities and availability for all Qt developers.
A big thanks to Sune Vuorela who proposed the idea for this article and the people who contributed to it, especially David Faure, John Layt and the many KDE developers who reviewed and added to the wiki.