QT & PyQT5

The Qt application framework is a mature, comprehensive, cross-platform development toolset primarily written in C++ that is used for creating graphical user interfaces (GUIs) as well as non-GUI applications for desktop, mobile, embedded, and web platforms.

It was originally conceived in the 1990s and has since become a leading framework known for its write once, deploy everywhere philosophy and its comprehensive set of APIs for everything from graphics and UI to networking, databases, and threading.


Qt Development with PyQt5: Free to Use

You can develop and use the Qt framework for free by leveraging its open-source licensing and the Python bindings provided by PyQt5.

ComponentDescriptionFree for Development & Use?Key License
Qt Framework (The C++ Core)The fundamental cross-platform libraries and APIs.Yes (under Open Source terms)GNU Lesser General Public License (LGPL v3) and GNU General Public License (GPL)
PyQt5The Python bindings for Qt 5, created by Riverbank Computing.Yes (if your project is open source)GNU General Public License (GPL v3) or a Commercial License
Qt WidgetsThe classic collection of desktop-style UI components (buttons, text boxes, etc.).YesLGPL/GPL
Qt Quick / QMLA declarative language (QML) and framework for building modern, dynamic UIs, especially for mobile and embedded systems.YesLGPL/GPL
Qt CreatorThe official cross-platform Integrated Development Environment (IDE).YesGPL
Qt DesignerA graphical tool for designing and creating UI forms using a drag-and-drop interface, generating .ui files.YesIncluded with the open-source Qt tools.

The Critical Licensing Point (GPL vs. LGPL)

The ability to use PyQt5 for free depends on the license you choose for your own application:

  1. Open Source Projects: If your application is distributed under a GPL-compatible open-source license, you can use PyQt5 for free.
  2. Proprietary/Closed-Source Projects:
    • Since PyQt5 is licensed under GPL v3, you must purchase a commercial license from Riverbank Computing if you intend to distribute a proprietary, closed-source application.
    • Alternatively, you can switch to PySide6 (the official Qt for Python bindings from The Qt Company), which is available under the more permissive LGPL v3 license. LGPL generally allows you to use the library in closed-source applications without purchasing a commercial license, provided you adhere to its specific terms (e.g., dynamically linking to the Qt libraries).

While the framework is the foundation, several tools aid the development process:

1. Development Tools

  • Qt Creator: The official IDE for Qt development. It integrates tools like the visual debugger and the build system (qmake or CMake).
  • Qt Designer: A WYSIWYG (What You See Is What You Get) tool for creating .ui files, which are XML-based descriptions of your user interface. PyQt applications can load these files directly or convert them to Python code using the pyuic5 tool.
  • Moc (Meta-Object Compiler): A tool essential for C++ that enables Qt's unique object communication system known as Signals and Slots, though this is handled automatically when using PyQt5 in Python.

2. Framework Components (Modules)

Qt is modular, meaning you only include the components you need. The core components free to use with PyQt5 include:

  • Qt Core: Essential non-GUI classes (threading, file I/O, event system, and the powerful Signals and Slots mechanism).
  • Qt Widgets: The library for traditional desktop applications with a native look and feel.
  • Qt GUI: Base classes for graphical elements, windowing, and OpenGL.
  • Qt Network: Classes for TCP/IP, UDP, and network programming.
  • Qt SQL: Database integration classes.
  • Qt Multimedia: Classes for audio, video, and camera functionality.
  • Qt Quick / QML: A declarative scripting language for rapid development of fluid, animated, touch-enabled user interfaces.

3. Cross Platform Compilation

PyQt5 code can be "compiled" (packaged into standalone executables) for a wide range of operating systems, limited primarily by the underlying Qt 5 framework's cross-platform support.

The main platforms it supports are:

Core Desktop Platforms These are the most common and easiest to deploy to using tools like PyInstaller or cx_Freeze:

  • Windows (32-bit and 64-bit Intel/AMD architectures)
  • macOS (Intel and Apple Silicon/ARM architectures)
  • Linux (Various distributions like Ubuntu, Fedora, using Intel/AMD and ARM architectures)

Mobile and Other Platforms While more complex and often requiring specialized tools like pyqtdeploy, PyQt5 (and Qt 5) can also target mobile and embedded systems:

  • Android
  • iOS
  • Various embedded systems (like Raspberry Pi, which uses ARM Linux).

Essentially, because PyQt is a binding for the C++ Qt library, it can run on any platform for which the Qt 5 framework itself has been ported. This makes PyQt a truly cross-platform solution for GUI development.

Fuentes