Friday, March 31, 2017

PyQt - Major Classes

PyQt API is a large collection of classes and methods. These classes are defined in more than 20 modules. Following are some of the frequently used modules −
S.No. Modules & Description
1 QtCore
Core non-GUI classes used by other modules
2 QtGui
Graphical user interface components
3 QtMultimedia
Classes for low-level multimedia programming
4 QtNetwork
Classes for network programming
5 QtOpenGL
OpenGL support classes
6 QtScript
Classes for evaluating Qt Scripts
7 QtSql
Classes for database integration using SQL
8 QtSvg
Classes for displaying the contents of SVG files
9 QtWebKit
Classes for rendering and editing HTML
10 QtXml
Classes for handling XML
11 QtAssistant
Support for online help
12 QtDesigner
Classes for extending Qt Designer
PyQt API contains more than 400 classes. The QObject class is at the top of class hierarchy. It is the base class of all Qt objects. Additionally, QPaintDevice class is the base class for all objects that can be painted.
QApplication class manages the main settings and control flow of a GUI application. It contains main event loop inside which events generated by window elements and other sources are processed and dispatched. It also handles system-wide and application-wide settings.
QWidget class, derived from QObject and QPaintDevice classes is the base class for all user interface objects. QDialog and QFrame classes are also derived from QWidget class. They have their own sub-class system.
Following diagrams depict some important classes in their hierarchy.
Hierarchy QWidget QDialog QIODevice QPaintDevice Here is a select list of frequently used widgets −
A typical GUI based application’s top level window is created by QMainWindow widget object. Some widgets as listed above take their appointed place in this main window, while others are placed in the central widget area using various layout managers.
The following diagram shows the QMainWindow framework −
QMainWindow

1 comment: