Qt features multiple technologies for creating user interfaces. While it is possible to mix and match these different technologies as needed, one approach is often better suitable for a certain type of user interface than the others. Qt Creator is a good example of an application that mixes different user interface technologies. In fact, it uses all of the three different approaches described below. Qt Creator uses the traditional Qt Widgets such as menus and dialogs as a basis of the user interface, Qt Quick amongst others for the welcome screen, and Qt WebKit for presenting the Qt reference documentation. The following sections provide brief introductions to the available technologies for creating user interfaces, and a comparison table to help choosing the best suitable technology.
Qt Quick provides everything needed to create applications with fluid and dynamic user interfaces. It enables user interfaces to be built around the behavior of user interface components and how they connect with one another, and it provides a visual canvas with its own coordinate system and rendering engine. Animation and transition effects are a first class concept in Qt Quick, and visual effects can be supplemented through specialised components for particle and shader effects. The Qt Quick elements are primitive user interface building blocks, whereas the Qt Widgets are more feature rich standard industry widgets.
Important Concepts in Qt Quick
- The Visual Canvas
- User Input
- States, Transitions and Animations
- Data - Models, Views and Data Storage
- Particles and Graphical Effects
- Convenience Types
- Internationalization and Localization
Qt Widgets are traditional user interface elements that are typically found in desktop environments. The widgets integrate well to the underlying platform providing native look'n'feel on Windows, Linux and Mac OSX. The widgets are mature and feature rich user interface elements suitable for mostly static user interfaces. In contrast to Qt Quick, the widgets do not scale that well for touch screens and fluid, highly animated modern user interfaces. The widgets are a good choice for applications with traditional desktop centric user interfaces, such as office type applications.
Important Concepts in Qt Widgets
- Application Main Window
- Desktop Integration
- Dialog Windows
- Layout Management
- Model/View Programming
- Rich Text Processing
- Drag and Drop
QtWebKit is a web content rendering engine based on the open source WebKit project featuring broad support for standard web technologies. The Qt WebKit module provides integration with both the above Qt technologies, a Qt Quick WebView component as well as the Qt WebKit Widgets classes to render and interact with web content.
The main difference in the underlying technology of the Qt Quick WebView component is that it utilizes a multi-process architecture (WebKit2) with a separate web rendering process whereas the Qt WebKit Widgets use a single-process architecture.
See also Integrating Web Content.
Notice that choosing the appropriate technology for building an user interface is not always black and white, but may depend on several criterias, such as other existing technologies used in a project or even target platform constraints. To some extent, many items in the following table can be implemented using any of the three available technologies. The following table merely aims to help you choose the best suited tool for the job.
|Qt Quick||Qt Widgets||Qt WebKit||Comments|
|Native look'n'feel||X||Qt Widgets integrate well to the underlying platform providing native look'n'feel on Windows, Linux and Mac OSX.|
|Custom look'n'feel||X||(X)||Qt Widgets provide means for customization via style sheets, but Qt Quick is a better performing choice for user interfaces that do not aim to look native.|
|Fluid animated UIs||X||Qt Widgets do not scale well for animations, and Qt WebKit's CSS3 animations are not as powerful as Qt Quick animations. Qt Quick offers a convenient and natural way to implement animations in a declarative manner.|
|Touch screen||X||Qt Widgets often require a mouse cursor for good interaction, whereas Qt Quick only provides primitive building blocks that were designed with touch interaction in mind. The WebView Qt Quick component has support for multi-touch gestures to interact with web content.|
|Standard industry widgets||X||Qt Widgets provide all the bells and whistles, developed over two decades, needed for building standard industry type applications. QtWebKit Widgets provide widgets and additional classes to render and interact with web content.|
|Model/View programming||X||X||Though some MVC like concepts exist in Qt WebKit, Qt Quick and Qt Widgets provide more convenient and complete frameworks.|
|Rapid UI development||X||(X)||Thanks to its superior productivity, Qt Quick is an excellent choice for rapid UI prototyping and development.|
|HW accelerated graphics||X||Qt Widgets provide QGLWidget for rendering OpenGL graphics, and Qt WebKit supports WebGL, but the OpenGL ES 2.0 or OpenGL 2.0 based Qt Quick Scene Graph has proven to provide the best performance for UIs and for integrating with OpenGL content.|
|Graphical effects||X||The particle system and shader effects available in Qt Quick are more flexible compared to CSS Effects and Shaders available in Qt WebKit. Qt Widgets offer very little in this area.|
|Rich text processing||X||Even though Qt's rich text document classes can be utilized in Qt Quick, Qt Widgets currently provide the most comprehensive base for implementing text editors.|
|Existing web content||X||Both Qt Quick and Qt Widgets prodive components for presenting simple rich text, but Qt WebKit is the right choice for presenting full-blown web content.|
Internationalization and Translations
Qt provides excellent support for translating applications into local languages. Release managers, translators, and developers can use Qt translation tools to accomplish their tasks.