This topic was published by DevynCJohnson and viewed 1749 times since "". The last page revision was "".
- Topics - 444
There are many frameworks and APIs for designing graphical user interfaces (GUIs) for applications. Qt is an example of such an API. Thus, Qt is also known as a "widget toolkit". Qt is probably best known for its use on the KDE desktop environment (Plasma Workspaces). Since Qt is so widely used, it may be a good idea if Linux users knew a few things about Qt.
Qt (https://qt-project.org/) is an open-source framework (exceptions apply) and is cross-platform. Qt may be used on Android, Linux, *BSD, Haiku, iOS, QNX, and many other systems. Some developers have made various ports to some systems not natively supported by Qt like OpenSolaris, EComStation (OS/2), webOS, Haiku, and many others. Even though Qt is written in C++, many bindings exist to allow Qt to be coded in other languages. For instance, Python developers that want to make a GUI for their Python program can use the PyQt binding which allows a Qt interface to be designed using Python code (https://wiki.python.org/moin/PyQt). There is also QtRuby for Ruby developers and PHP-Qt for PHP5 coders.
I had mentioned in the previous paragraph that Qt is open-source with some exceptions. A lot of the Qt-framework is open-source under the LGPL and GPL license. However, the commercial version has more features. The company that currently owns the closed-source portions of Qt is Digia. Digia does offer thorough explanations of the licensing. Users can obtain the source code for the open portions of the program here (https://qt.gitorious.org/). Users can purchase the "Qt Enterprise Edition" or they can freely use the "Open Source Edition" with their programs. There are also different kinds of the "Qt Enterprise Edition" like "Qt Enterprise Embedded Edition" and "Qt Enterprise RTOS Edition".
Even farther back, QSA (Qt Script for Applications) was the Qt-scripting language before QtScript and QML. Again, use QML because the other Qt-scripting languages are deprecated.
When projects using Qt need to be compiled, the "qmake" command will be needed to generate a "Makefile" for the source code. "Makefiles" are special files containing code that informs the "make" utility how to compile/build a specific set of source code. "qmake" is an official Qt tool made by Digia. However, some developers prefer to use a third-party tool called "CMake".
Qt Creator (http://qt-project.org/doc/qtcreator-3.1/index.html) is a full IDE suite for Qt. Qt Creator support various compilers, make-tools, debuggers, version control systems, syntax highlighting, and many other features. Keep in mind though that the system must have the debuggers, compilers, and other external tools installed for Qt Creator to be able to take advantage of such tools. Qt developers are encouraged to use Qt Creator for their Qt programing.
Qt Designer was the popular IDE before Qt Creator. Qt Designer has less features than Qt Creator. Qt Designer is not used as much as the preferred and recommended Qt Creator.
Qt Quick is a WYSIWYG editor for Qt applications. Qt Quick is a module that is part of the Qt Creator IDE. Qt Quick uses QML to design GUIs.
Qt Declarative is the QML interpreter used by Qt Quick.
Qt Simulator is a testing environment for Qt applications intended for mobile devices. The Qt Simulator allows developers to see how their program reacts in a mobile environment even if the developer does not own a mobile device.
As for bindings again, I want to discuss PySide and PyQt. Both are Python bindings for Qt, but the question is which should a developer use? Well, let us examine both. PySide is entirely open-source freeware while PyQt is partially open-source (like the Qt framework). PySide supports Qt4 but not Qt5. PySide can run on Python2 and Python3. As for PyQt, it supports Qt4 (as PyQt4) and Qt5 (as PyQt5). However, PyQt4 works on Python2 and Python3 while PyQt5 only works on Python3. The two bindings use different APIs as thoroughly discussed here (http://qt-project.org/wiki/Differences_Between_PySide_and_PyQt). By "different APIs", I am referring to the fact that each binding may use a different command to call the same Qt command. In both bindings, the syntax is still the same standard Python syntax. In summary, whether a developer should use PyQt or PySide is different for each developer and depends on the developer's needs.
To install the Python bindings, use your preferred package manager or checkout these links -
- Download PyQt4 - http://www.riverbankcomputing.co.uk/software/pyqt/download
- Download PyQt5 - http://www.riverbankcomputing.co.uk/software/pyqt/download5
- Download PySide - https://pypi.python.org/pypi/PySide
- PySide (Alternate_Link) - http://qt-project.org/wiki/Get-PySide
Sample PyQt4 (Python2) Script
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from PyQt4.QtGui import * a = QApplication(sys.argv) w = QWidget() w.resize(320, 240) w.setWindowTitle("Hello, World!") w.show() sys.exit(a.exec_())
Sample PySide-Qt4 (Python2) Script
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from PySide.QtGui import * a = QApplication(sys.argv) w = QWidget() w.resize(320, 240) w.setWindowTitle("Hello, World!") w.show() sys.exit(a.exec_())
As readers can see, Qt is a well supported widget-toolkit. Many bindings and tools are available for a variety of developers and their needs. The Qt framework provides code to make GUI that are supported on a variety of operating systems including mobile and embedded systems.