QT Program Library

Source: Internet
Author: User
Tags vector graphics library xml parser

In fact, QT is not just a huge library, but a library of 7 libraries, including many use tools, Qmake is one of them. Today, the term GUI toolkit represents something that is no longer just a small part of what the system provides (GUI interface). QT, in particular, contains extension classes for many aspects of application development. Many of these are related to the graphical interface of the program, but there are many classes that involve network programming, OpenGL support, and XML development. A wide range of uses depend on the platform independence of the QT class: With few exceptions, all classes are available on all operating systems, and the same classes have the same methods and behaviors. QT4 contains the following libraries:
Qtcore contains basic classes that do not have a GUI interface.
Qtgui contains the GUI base class.
Qtnetwork contains the network class.
Qtopengl contains OpenGL support.
QTSQL contains SQL database classes.
Qtxml contains XML and DOM classes. (see page 45th)
Qtassistantclient allows you to use the QT Assistant as your program's document browser.
The qt3support contains classes to ensure compatibility with QT3. Qt 4.1 Adds the Qtsvg library, provides support for SVG vector graphics formats, and also adds the Qttest library, also known as Qtestlib, including the unit test framework.
In the final version of Qt 4.2, the Qtdbus module was added to support freedesktop.org's public Information System (DBUS). You may need to connect the program code to multiple library files, most of which are Qtcore and Qtgui. Therefore, the qmake contains both libraries by default.
The library file that needs to be connected is specified by the Qmake variable QT. The default contains the variable core and GUI. For example, to develop a graphical interface program with network support, you should add the value network to the QT variable. Add such a line in the project file. Pro:
QT + = Network
To write a console program that supports XML, you only need to link qtcore and qtxml, not Qtgui, so you have to add the value XML and remove the value GUI. Add the following two lines to the project file:
QT-= GUI
QT + = XML
If you want to use all of the library files in QT 4.0, write this:
QT + = network OpenGL SQL XML support (core and GUI default inclusions, no write required)
In addition to being specified in the project file, there is another particularly useful topic about QT Library knowledge. In addition to defining a separate header file for the class (the file names of these headers are consistent with the names of the classes they describe), QT also provides a header file for its library. Each of these files contains an interface description for many of the class files of a library. So, from the beginning of this book to all the examples so far (we've just used classes in Qtgui), we didn't write many of the individual # include declarations, but simply wrote:
#include <QtGui>
However, the header files of these libraries are usually very long, significantly slowing down the compilation process, written in <QtGui/QLabel> better. This will not be a problem if the compiler supports precompiled header files, but only the most recent compilers (such as GCC3.4 and above) are supported. Base Library Qtcore
Qtcore is an essential library for every Q program. In addition to the rest, it provides the following features:
Basic data types, such as qstring and Qbytearray
Basic data structures, such as qlist, Qvector, and Qhash
Input and output classes, such as Qiodevice, Qtextstream, and Qfile
Classes that support multithreaded programming (including Qwaitcondition and Qthread)
Base classes Qobject and Qcoreapplication (base class for qapplication classes)
These classes are not dependent on GUI components. Independent of the GUI allows QT programs to not use GUI interfaces (such as console programs).
In the non-graphical interface program, Qcoreapplication assumes the responsibility of qapplication in the graphical interface program: responsible for the event loop. This is useful if you need to use multi-threaded asynchronous communication in a network connection. Graphical Interface Library Qtgui
The Qtgui library contains the required class files for all graphical user interface programming:
The Qwidget class and its subclasses, such as Qlabel and Qpushbutton, etc.
Layout classes (including Qvboxlayout, Qhboxlayout, and Qgridlayout)
Classes for adding menus to programs, such as Qmainwindow and Qmenu
Classes for drawing, such as Qpainter, Qpen, and Qbrush
Classes that provide ready-made dialog boxes (including Qfiledialog and Qprintdialog)
Qapplication class
The Qtgui library relies on the Qtcore library Network library Qtnetwork
The Qtnetwork library provides some of the classes needed to write a network application. In addition to supporting simple socket communication through the Qtcpsocket and Qudpsocket classes, the network library is also available through qhttp and qftp. Support for HTTP and FTP connections to CS (client-server).
Unlike Qtgui, Qtnetwork relies on the Qtcore library, but it can also be used with Qtgui and other libraries. OpenGL Support Library Qtopengl
The QTOPENGL library supports the use of OpenGL in QT programs. It provides a qglwidget class-a QT widget where you can draw with OpenGL instructions. Qtopengl relies on the Qtcore and Qtgui libraries. Database Class Qtsql
The Qtsql library provides the ability to access SQL databases in QT programs. This library contains classes for establishing SQL database connections and querying and modifying data. The range of SQL data supported by QT includes: Open source database PostgreSQL, MySQL and SQLite. Qtsql relies on the Qtcore library, and we'll discuss it in the Nineth chapter. XML Library Qtxml
The Qtxml library provides a simple, non-validating XML parser. It implements this functionality through the SAX2 (simple API for XML) interface.
Qtxml also contains an implementation of the DOM standard (Document Object model). The corresponding class allows you to parse an XML document, manipulate the tree structure, publish the modified document in an XML document format, or create a new XML document using the DOM.
This library relies on the Qtcore library, which we will discuss in more detail in the 13th chapter. Qt3 Compatibility library Qt3support
QT 4 has changed considerably compared to the previous QT 3: Some classes contain improvements that are incompatible with QT 3, and some classes are replaced by new classes of different names in Qt 4. In order to simplify the QT 3 program porting to QT 4, the company offers the corresponding QT 3 classes in the Qt3support library. However, you should not use this library in a new program because these classes have stopped developing. Because this book is about QT 4 programming, we will not use these classes, and will not discuss them in the future. Vector Graphics Library qtsvg
The XML-based SVG vector graphics format published by the publishers has great potential. Starting with QT version 4.1 The Qtsvg library supports the SVG specification SVG basic and SVG Tiny, which are used to display SVG files and animations, although qtsvg libraries cannot create them, nor can they be manipulated as XML documents using the DOM tree as an SVG file. Help Library Qtassistantclient
The QT Helper Library allows you to precisely control the QT helper application. Allows you to use it as a standalone Help file browser for your program's platform. The core of this module is the Qassistantclient class.
The custom help page used by the QT Assistant must be a basic HTML format, and an XML file must be used to describe the structure of the document. Test Library Qtestlib
Originally Qtestlib was offered to paid users outside the QT core release, and was included in the QT regular release from Qt 4.1.0. The test library contains tools for writing rigorous unit tests that cover a similar scope to JUnit in Java. Message Store Qtdbus
Qtdbus is a message protocol on Linux and Unix-like systems. For example, the Linux hardware Abstraction layer (HAL) and the upcoming KDE4 all use Dbus as the interprocess communication protocol. Although the ported version of Windows and Mac OS X already exists, QT 4.2 will only provide Qtdbus libraries for UNIX systems. However, there may be changes in the future. ACTIVEQT and Migration classes
The Windows platform-specific extension ACTIVEQT makes it possible to implement ActiveX components through Qt and to use ActiveX components in QT programs. However, this feature is only available in the commercial version of QT. It also provides solutions for migrating from Mfc,motif and XT-based programs. However, like ACTIVEQT, they are provided only as a separate business plugin for QT 4 (QT Solutions), so they are not discussed in this book. Reference http://www.cnblogs.com/mcxiaoke/archive/2010/05/17/1737213.html

QT Program Library

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.