C++ Programming

Qt Libraries C++ with full details

Qt Libraries C++:

Qt Libraries- If you have looked at the classes a little with the Qt Assistant in my previous article, you noticed that Qt is split into several packages (modules). In addition to the Qt offers much more for the development of graphical user interfaces of applications. In this article, we will discuss Qt libraries in more detail.

  • QtCore contains the basic (core) functions and classes without graphical Interface used by the other libraries.
  • QtGui extends the QtCore library and includes the entire GUI functionality.
  • QtNetwork contains all classes and functions that are necessary to e.g. Write TCP / IP (and UDP) server and / or client applications.
  • QtOpenGL contains classes that make it easy to use the OpenGL interface to be used in Qt applications.
  • QtOpenGL contains classes that make it easy to use the OpenGL interface to be used in Qt applications.
  • QtSql is responsible for the integration of SQL databases in the Qt application.
  • QtSvg provides classes for displaying SVG graphics (vector format).
  • QtXml contains C ++ implementations of SAX and DOM classes.
  • QtDesigner contains classes with which you can add plugins (widgets) for the Qt Designers can create.
  • QtUiTools – this part of the library contains classes (at the moment actually only one) that allow you to run standalone applications (user interfaces; Generate user interfaces (UI) dynamically at runtime and save it in a .ui file.
  • QtAssistant enables the use of the Assistant’s online help from Qt. Qt3Support contains classes to convert applications from version 3 to version 4 to port.
  • QtTest is used to test Qt applications and libraries.
  • QtScript and QtScriptTools contain classes for processing ECMAScript(= JavaScript). QtScriptTools contains additional ones for this Classes.
  • QtWebKit contains classes for displaying and processing web pages (since Qt 4.4).
  • Phonon includes classes for using multimedia content such as Audio or video (since Qt 4.4).
  • QtMultimedia includes multimedia functionality on the lower level Level (since Qt 4.6).

The commercial version of Qt under Windows offers with QAxContainer and QAxServer also has two program libraries for ActiveX controls and ActiveX server. The QtDBus. Library is available for all Unix platforms (and Qt editions) classes for inter-process communication with D-BUS are still available.


allpcb circuit

Amazon Purchase Links:

Top Gaming Computers

Best Laptops

Best Graphic Cards

Portable Hard Drives

Best Keyboards

Best High Quality PC Mic

Computer Accessories

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

D-BUS :

D-BUS is a software system that offers several options for programs to communicate with each other.

When you use qmake to build your projects, QtCore (core) and QtGui (gui) added by default. For example, do you want your Project is only linked to QtCore, you need the following in the .pro file (project file) Change or add line:

QT – = gui

The usage corresponds to the extended operators of C / C ++. Do you want For example, to add the QtNetwork library to the project, you only need to do the following insert into the .pro file:

QT + = network

The library to be linked specifies qmake with QT. If you have a Qt library you just need to add the + = operator in front of the library you want put. If a library is to be removed, do this with

– = operator.

In the following table (1) you will find the possible values ​​that you can use for the QT variable the .pro file (project file) you can use and what library Link them to it.

QT value (option) Qt Library
core (implemented by standard) QtCore
Designer QtDesigner
gui (implemented by standard) QtGui
Network QtNetwork
Multimedia QtMultimedia
Opengl QtOpenGL
Phonon Phonon
qt3support Qt3Support
Qtestlib QtTest
Script QtScript
Scripttools QtScriptTools
Sql QtSql
Svg QtSvg
Uitools QtUiTools
Webkit QtWebKit
xml QtXml

Table 1: Link libraries

Of course, it is also possible to link several libraries to the project. To do this, you just have to separate several libraries from the .pro file from a space, add:

QT + = network opengl sql svg xml qt3support

With this you would have practically all libraries (gui and core are by default at the same time) linked.




Qt Libraries c++:

QtCore Library:

This Qt library is the fundamental base library on which Qt is based and includes in the only classes that are not associated with any graphical output. QtCore library also includes the STL (Standard Template Library) – including the functionality and the type of use. All of Qt’s own container classes (and also strings) use this method “copy on write”. This allows the classes to be set up without much effort return as function value.

The class QString (for handling character strings) is also part of QtCore. It has already been mentioned that the individual characters here are in the Unicode Standard (UTF-16) can be coded. Instead of a char comes a short int (16 bits) for the course. Of course, QString also contains everything you need for Conversions of different character set systems such as ASCII, UTF, various ISO standards, etc.

QtCore is also available for the QObject and QCoreApplication classes (base class for QApplication). In total, QtCore contains more than 200 classes. The basic ones and the most common ones in practice are brief here written down:

  • the basic data types QString and QByteArray.
  • the basic data structures (as with STL) QList, QVector, QHash QMap, etc.
  • I / O classes like QFile, QDir, QTextStream etc.
  • Classes to program multithreads like QThread, QMutex, QWaitCondition etc.
  • Date and time classes such as QDate, QTime, and QDateTime.
  • Loading libraries and plugins at runtime like QLibrary and QPluginLoader
  • The QObject class, main vehicle for many concepts such as communication between Signals and slots, memory management and object properties.

QtCore is often used alone without QtGui to run client / server programs to write with multithreads or sockets. Often there is no graphic for this Surface necessary.



QtGui Library:

First of all, QtGui requires the QtCore library. QtGui contains all classes drawing something on the screen. The QtWidget class is expanded. QtWidget by itself is basically just drawing an empty rectangle on the screen. New GUI elements are also created using QWidget by using the new class is derived from it. in the following we count the most common parts of QtGui in bullet points:

  • Classes to use ready-made dialogs (e.g. QFileDialog (file selection), QPrinterDialog (print document), QColorDialog (color selection), etc.);
  • Classes to arrange the widgets – so-called layout classes (e.g. QVBoxLayout, QHBoxLayout, QGridLayout, etc.);
  • the QWidget class and countless GUI classes derived from it;
  • Classes for drawing on the screen (e.g. QBrush, QPainter, QPen, etc.);
  • the class QApplication.

QtNetwork Library:

The QtNetwork class offers a variety of classes with which you can use TCP / IP (as well as UDP) client / server applications. Next to the classes QTcpSocket, QTcpServer and QUdpSocket, which operate on a lower level, QtNetwork offers higher-level classes with QHttp and QFtp, which means the HTTP and FTP protocol can be used. QtNetwork required also the QtCore library, but not QtGui.

QtOpenGL Library:

This qt library allows you to use the OpenGL API in your Qt application. OpenGL is a portable standard interface for rendering 3D graphics (similar to DirectX). With QtOpenGL, you can use OpenGL like any other Qt widget.



QtSql Library:

this Qt library includes classes for supporting SQL databases. The following table (2) lists client APIs for which Qt has a suitable Provides driver.

Driver name Database system
QIBASE Borland InterBase
QMYSQL MySQL
QODBC Open Database Connectivity (ODBC)

(used by Microsoft SQL Server)

QPSQL PostgresQL
QSQLITE2 SQLite (Version 2)
QSQLITE SQLite (version 3)

Table 2:Databases for which Qt supplies a driver

These drivers are definitely included in the open source edition of Qt. Other database systems or drivers that are not compatible with the GPL are only available for the commercial version of Qt (see table 3).

Driver name Database system
QDB2 IBM DB2
QOCI Oracle Call Interface Driver
QTDS Sybase Adaptive Server

Table 3: DBMS (only in the commercial version of Qt)

What is particularly impressive about QtSql is the fact that you only have one Database system and immediately afterwards with the Qt Code can access any DB interface.

QtSvg Libraries:

The Qt library supports classes that allow vector graphics to be used with the Display SVG format. SVG (Scalable Vector Graphics) Is a standard for describing two-dimensional vector graphics in XML syntax. SVG was recommended by the W3C in September 2001 released. Many current web browsers are inherently able to represent a large part of the language scope, such as Mozilla Firefox or Opera. So far, QtSvg supports the SVG-Basic and SVG-Tiny profiles. ECMAScripts and DOM manipulations are currently not supported by Qt.



QtXml Libraries:

this Qt library provides a simple XML parser. This can be used directly via the SAX2 interface (SAX = Simple API for XML). The DOM standard (DOM = Document Object Model) implemented. This allows an XML document to be parsed and the corresponding Change or adapt tree structure. The so modified document can of course be output as an XML document. DOM even allows you to create a new XML document from it.

Qt3Support Libraries:

Because Qt4 has been enormously expanded and improved compared to Qt3 and is partly incompatible Trolltech supplies this library. We describe, however Qt version 4 and will not go into further detail.

QtScript Libraries:

With this Qt library you can create a script language compatible with ECMA-262 (e.g. JavaScript) in C ++ applications. This then becomes an environment used for dynamic interaction with Qt objects can be.

Phonon

Like the Webkit, Phonon (formerly called KDEMM) is a multimedia API from the KDE project and since version 4.4 also with Qt as a multimedia interface on board. Phonon offers a uniform (wrapper) interface for Audio and video applications similar to DirectShow under Windows or QuickTime on Mac OS X.

The rest Libraries:

To the other Qt libraries such as QtMultimedia, QtDesigner, QtUiTools, QtTest and commercial libraries are not discussed in this book. There is also a migration solution in Qt4 for MFC, Motif and Xt-based applications. This is also a commercial one Solution that Trolltech offers separately under the name QtSolution.




Meta include header file:

All Qt program libraries from the above Section are also available as meta-include Header file included, for example, the individual classes from the GUI library Include QtGui as follows:

#include <QPushButton>

#include <QMessageBox>

#include <QWidget>

#include <QPushButton>

#include <QVBoxLayout>

#include <QLabel>

Instead of the many inclusions of the header files, you can also use the meta Include header file QtGui:

#include <QtGui>

If you look at this meta include file, you will see that all of the Classes of the GUI library are included. A disadvantage of this inclusion it may take a little longer to compile. in the Basically, this only applies to older compilers that have not been precompiled Support header files. In the article examples, we will first use the class header files and then gradually introduce the meta include file. In principle corresponds to the class name with Qt also the header name. For example, if the class name is QPushButton, you just have to add the include <QPushButton> (or just the meta include file <QtGui>).

The same applies to all other libraries as to the QtGui library with their meta include. So you can use the QtXml library instead of the countless Only add the meta include <QtXml> to XML include files.

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button