Qt and Its Tools Explained

Is Qt your preferred toolkit/framework?

  • Yes

    Votes: 0 0.0%
  • No

    Votes: 0 0.0%
  • Not sure / Anything works for me

    Votes: 0 0.0%

  • Total voters
    0
D

DevynCJohnson

Guest
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. (https://qt-project.org/)

Qt 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".
(http://qt.digia.com/Try-Buy/)(https...ds)(https://qt-project.org/products/licensing)

Some people familiar with Qt may have heard of QML. QML (Qt Meta Language or Qt Modeling Language) is an scripting language for specifying how the interface should look. In other words, this is the Qt-GUI source code for an application's GUI. QML files may contain JavaScript code in the file itself, or QML files may reference/execute JavaScript files (*.js). C++ code can be used to add extra features and abilities. Qt-Declarative executes the QML script. The QML language and files do not resemble XML, nor is QML a form of XML. QML is a JavaScript-like language.

QtScript is a deprecated scripting language that was a lot like QML. Many of you may be wondering which is better. Well, QtScript is deprecated and QML is the current standard, so try to use QML instead of QtScript. When QtScript was active, it used its own JavaScript engine, but it then switched to JavaScriptCore which is the js-engine used by Webkit.

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" (http://www.cmake.org/)(http://qt-project.org/doc/qt-5/cmake-manual.html). (https://qt-project.org/doc/qt-5/qmake-manual.html)

Qt Creator 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 programming. (http://qt-project.org/doc/qtcreator-3.1/index.html)

qt_creator.png


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.

pyqt_vs_pyside.png


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 Alternate_Link - http://qt-project.org/wiki/Get-PySide

Sample PyQt4 script:
Code:
#! /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_())





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.

If you like or dislike Qt, please share your thoughts with us in the comments below.
 

Attachments

  • slide.jpg
    slide.jpg
    41.6 KB · Views: 323,385
  • PyQt4_py2.txt
    211 bytes · Views: 1,192
  • PySide_Qt4_py2.txt
    212 bytes · Views: 1,072


As for my programming, I do not have a preference for PyQt or other Python toolkit bindings. As for PySide vs PyQt, I prefer PyQt, and for PyQt4 vs PyQt5, I prefer PyQt5. Since I use Python3 more often than Python2 and I like Qt5 better than Qt4, using PyQt5 is the obvious choice for me.

Do some of you programmers of other languages have specific Qt-bindings that you prefer?

As for an IDE, I use Geany. I have never tried Qt Creator. I plan to try it in the future.
 
We are using QT at work. Signals & Slots features are making it perfect for some more abstract console applications. :D
 
I tried Qt around the time 4 just got released in C++. While it was nice, my mind couldn't figure out the mappings of function calls. But, really, C++ isn't for me (surprisingly Java has been though).

Qt is essentially required when using KDE or a fork of it, though. While there are GTK and such, Qt is basically the backbone of KDE.
 
I am from China Beijing,My English is just-so-so,but I want to say that qt will be one of the most popular IDES in the near future。Your teams will change the world.
 

Staff online


Top