PyQt5 QWidget: a list of functions and uses

QWidget in PyQt5 is a basic GUI component for creating user interfaces. It provides the basic functions and features of the window, including window management, event handling, drawing, layout, etc. QWidget can be used as a container for other GUI components, and can create custom components through custom inheritance. It also supports the creation of style sheets and transparent windows to customize appearance and behavior as desired. QWidget is one of the key components for building powerful and interactive GUIs.

The QWidget class is the base class for all user interface objects.

A widget is the smallest unit of user interface: it receives mouse, keyboard, and other events from the window system and draws a representation of itself on the screen. Each widget is rectangular, and they are sorted in Z order. Widgets are clipped by their parent window and other widgets in front of them.

A widget that is not embedded in a parent widget is called a window. Normally, windows have a border and title bar, but it is also possible to create windows without these decorations using the appropriate window flags. In Qt, QMainWindow and various subclasses of QDialog are the most common window types.

Each widget's constructor accepts one or two standard parameters:

QWidget *parent = 0 is the parent window of the new widget. If it is 0 (the default), the new widget will be a window. If not, it will be a child of the parent, subject to the parent's geometric constraints (unless you specify Window as the window flag).

Qt::WindowFlags f = 0 (if available) sets window flags; default works for almost all widgets, but to get e.g. windows without window system borders you have to use special flags.

QWidget has many member functions, but some of them have little direct functionality; for example, QWidget has a font property, but it is never used itself. There are many subclasses that provide the actual functionality, such as QLabel, QPushButton, QListWidget, and QTabWidge

Guess you like

Origin blog.csdn.net/qq_29901385/article/details/131555389