"PyQt5-Basics" | 01 Simple basic understanding
1 Qt understanding
- Cross-platform
C++
graphical user interface application development framework; - It can
GUI
be used to develop both programs and non-GUI
programs; Qt
The interface of the developedGUI
program is the same as that of the current operating system;- The cross-platform mode of the program developed with
Qt
is source code level.
1.1 Supported platforms
MS/Windows - 95、98、NT4.0、ME、2000、XP 、 Vista、Win7、win8、win2008、win10
Unix/X11 -Linux、SunSolaris、HP-UX、CompaqTru64 UNIX、IBMAIX、SGI IRIX、FreeBSD、BSD/OS和其它很多X11平台
Macintosh -Mac OS X
Embedded - 有帧缓冲(framebuffer)支持的嵌入式Linux平台,Windows CE、Symbian、Symbian^3、Symbian Anna、Symbian Belle、MeeGo、haiku-os。
1.2 Qt Creator
Qt Creator
It is aQt
lightweight cross-platform integrated development environment for development;- Provide an integrated development environment ( ) designed to support cross-platform development
IDE
; - This ensures that developers who come into contact with the Qt framework for the first time can quickly get started and operate it.
2 PyQt5
-
PyQt5
It is a language implementation based on the graphics programmingQt5
frameworkPython
; -
Official website: https://riverbankcomputing.com/ ;
-
PyQt5 document address: https://www.riverbankcomputing.com/static/Docs/PyQt5/ .
2.1 PyQt5 main modules
- The following are the main modules, you can learn other content from the official:
module | illustrate |
---|---|
QtCore |
Core non- functions are used to handle objects such as time, files, directories, data types, text streams, links, threads or processes GUI involved in the program.QMimeData |
QtGui |
Classes for basic graphics functions, such as window sets, event handling, 2D graphics, basic images and interfaces, fonts and text classes, etc. |
QtWidgets |
A complete set UI of element controls for building Classic an interface that conforms to the system style. You can choose whether to use this feature during installation. |
QtMultimedia |
A set of class libraries for processing multimedia events, API accessing cameras, voice devices, sending and receiving messages ( Radio Functionality ), etc. by calling interfaces |
QtBluetooth |
Class library for handling Bluetooth activities, including scanning devices, connections, interactions and other behaviors |
QtNetwork |
Network programming class library, providing TCP/IP及UDP的C/S code collection |
QtPositioning |
Obtain location information, such as satellite, wireless network, text information, etc. |
Enginio |
Build client-side application libraries for runtime access to Qt Cloud server-hosted applications |
QtWebSockets |
A set of class programs used to implement WebSocket protocols |
QtWebKit |
Class library that implements WebKit2 web browser-based |
QtWebKitWidgets |
A set of class libraries for implementing a web browser Widgets built from packages based onWebKit1 |
QtXml |
XML A class library for processing that provides functions for the implementation of SAX andDOM API |
QtSvg |
A set of class libraries that provide functions for displaying the contents of vector graphics files |
QtSql |
Database object interface |
QtTest |
Unit testing, debugging PyQt5 applications |
QtHelp |
Classes for creating and viewing findable documents |
QtOpenGL |
Use OpenGL libraries to render 3D and 2D graphics |
QtXmlPatterns |
Support for AND with XML custom data modelsXquery XPath |
QtDesigner |
Use PyQt extensionsQt Designer |
Qt |
Combine classes from all modules into a single module |
uic |
Process .ui files |
2.2 PyQt5 main classes
PyQt5 API
Have620
multiple classes and6000
functions;- The following are the main classes and descriptions:
kind | illustrate |
---|---|
QObject |
The top class ( Top Class ) is PyQt the base class for all objects |
QPaintDevice |
Base class for all drawable objects |
QApplication |
Manage the control flow and main settings of GUI applications |
QWidget |
Base class for user interface objects |
QFrame |
Base class for framed window controls |
QMainWindow |
Main application window with menu bar, dock windows (such as toolbars), and status bar |
QDialog |
The most common top-level window |
2.3 Inheritance relationship of important classes
PyQt 5
Important classes and their inheritance relationships:
2.4 Common controls
control | illustrate |
---|---|
QLabel |
Display text or image |
QLineEdit |
A single-page, single-line text editor |
QTextEdit |
A single-page multi-line text editor |
QPushButton |
command button |
QRadioButton |
radio button and a text or pixmap label |
QCheckBox |
Checkbox with text label |
QspinBox |
Allows the user to select a value, either by pressing the up/down keys to increase/decrease the currently displayed value, or by entering the value directly into the input box |
QScrollBar |
horizontal or vertical scroll bar |
QSlider |
Vertical or horizontal slider |
QComboBox |
Combination button for popup list |
QMenuBar |
horizontal menu bar |
QStatusBar |
A horizontal bar suitable for presenting status information, usually placed at QMainWindow the bottom of |
QToolBar |
Toolbar, which can contain multiple command buttons, usually placed at QMainWindow the top of |
QListView |
Display and control optional multi-select lists, which can be setListMode或IconMode |
QPixmap |
Display an image on a drawing device, usually placed in the QLabel or QPushButton class |
Qdialog |
Base class for dialog windows |