Qt 是一个免费的开源小部件工具包,用于创建图形用户界面以及跨平台的应用程序,这些应用程序可以在各种软件和硬件平台(例如 Linux,Windows,macOS,Android 或嵌入式系统)上运行,而底层代码库的更改很少或没有更改,同时仍然是具有本机功能和速度的本机应用程序(a native application)。
Qt 目前是由公开上市公司 The Qt Company 和 Qt Project 在开源治理下开发的,其中包括致力于提高 Qt 的个人开发人员和组织。Qt 可在商业许可和开源 GPL 2.0,GPL 3.0 和 LGPL 3.0 许可下使用。
Qt 用于开发在所有主要台式机平台以及大多数移动或嵌入式平台上运行的图形用户界面(GUI)和多平台应用程序。使用 Qt 创建的大多数 GUI 程序都具有本机外观的界面,在这种情况下,Qt 被归类为小部件工具箱。还可以开发非 GUI 程序,例如服务器的命令行工具和控制台。web framework 框架是使用 Qt 的此类非 GUI 程序的示例。
Qt 支持各种编译器,包括 GCC C ++ 编译器和 Visual Studio 套件,并具有广泛的国际化支持。Qt 还提供了 Qt Quick,它包括一种称为 QML 的声明性脚本语言,该语言允许使用 JavaScript 提供逻辑。借助 Qt Quick,可以实现针对移动设备的快速应用程序开发,同时仍然可以使用本机代码编写逻辑,以实现最佳性能。其他功能包括 SQL 数据库访问,XML 解析,JSON 解析,线程管理和网络支持。
Qt 首次发布时使用了自己的绘图引擎和控件,模拟了绘制小部件时运行的不同平台的外观。因为 Qt 中很少有类真正依赖于目标平台,这使得移植工作更加容易。但是,这有时会导致在模拟不完善的地方出现细微的差异。Qt 的最新版本在具有本机小部件集的平台上使用不同平台的本机样式 API,以查询指标并绘制大多数控件,而不会经常遇到此类问题。在某些平台(例如 MeeGo 和 KDE)上,Qt 是本机 API。其他一些便携式图形工具包做出了不同的设计决策。例如,wxWidgets 将目标平台的工具包用于其实现。与 Qt 相关的离线安装包见:https://www.qt.io/offline-installers。
1 Qt 的模块
从 Qt 4.0 开始,该框架被划分为各个模块。借助Qt 5.0,该架构得以进一步模块化。Qt 现在分为基本模块和附加模块。
1.1 Qt essentials
Module | Description |
---|---|
Qt Core | The only required Qt module, containing classes used by other modules, including the meta-object system, concurrency and threading, containers, event system, plugins and I/O facilities. |
Qt GUI | The central GUI module. In Qt 5 this module now depends on OpenGL, but no longer contains any widget classes. |
Qt Widgets | Contains classes for classic widget based GUI applications and the QSceneGraph classes. Was split off from QtGui in Qt 5. |
Qt QML | Module for QML and JavaScript languages. |
Qt Quick | The module for GUI application written using QML2. |
Qt Quick Controls | Widget like controls for Qt Quick intended mainly for desktop applications. |
Qt Quick Layouts | Layouts for arranging items in Qt Quick. |
Qt Network | Network abstraction layer. Complete with TCP, UDP, HTTP, SSL and since Qt 5.3 SPDY support. |
Qt Multimedia | Classes for audio, video, radio and camera functionality. |
Qt Multimedia Widgets | The widgets from Qt Multimedia. |
Qt SQL | Contains classes for database integration using SQL. |
Qt WebEngine | A new set of Qt Widget and QML webview APIs based on Chromium. |
Qt Test | Classes for unit testing Qt applications and libraries. |
1.2 Qt add-ons
Module | Description |
---|---|
Active Qt | Classes for applications which use ActiveX. |
Qt Bluetooth | Classes accessing Bluetooth hardware. |
Qt D-Bus | Classes for IPC using the D-Bus protocol. |
Qt NFC | Classes accessing NFC hardware. Only officially supported on BlackBerry hardware so far (or N9 in the MeeGo port). |
Qt OpenGL | Legacy module containing the OpenGL classes from Qt 4. In Qt 5 the similar functionality in Qt GUI is recommended. |
Qt Location | Classes for accessing GPS and other location services and for mapping and navigation. Split off from the Qt 4 Mobility module of Qt Location. Supported on Android, BlackBerry, iOS, Linux (using GeoClue), Windows and Sailfish OS. |
Qt Script | Legacy module for scripting Qt application using ECMAScript/JavaScript. In Qt 5, using similar classes in Qt QML is recommended. |
Qt Sensors | Classes for accessing various mobile hardware sensors. Used to be part of Qt Mobile in Qt 4. Supported on Android, BlackBerry, iOS, WinRT, Mer and Linux. |
Qt Serial Port | Classes for access to hardware and virtual serial ports. Supported on Windows, Linux and macOS. |
Qt WebChannel | Provides access to Qt objects to HTML/Js over WebSockets. |
Qt WebKit | Qt's WebKit implementation and API. |
Qt WebKit Widgets | The widget API for Qt WebKit |
Qt WebSockets | Provides a WebSocket implementation. |
Qt XML | Legacy module containing classes for SAX and DOM style XML APIs. Replaced with QXmlStreamReader and QXmlStreamWriter classes in Qt Core. |
Qt XML Patterns | Support for XPath, XQuery, XSLT and XML Schema validation. |
网友评论