Widgets are the basic building blocks of a Graphical User Interface application, which are combined or grouped in a way that helps in interaction and manipulation. Qt
comes with a variety of basic and advanced built-in widgets that can be customized to our own needs. A list of predefined widgets is given in the following tables for your reference. QWidget
is the base class for all the widgets given in the list.
The basic widgets section contains the list of widgets that are simple and designed for direct use. The following list contains the available basic widgets, most of which we have used in the examples that we have seen so far:
Advanced widgets provide more complex user interface controls, which may be used in creating various advanced applications. These widgets make the work of programmers easy by providing us with the most common application features as widget libraries.
The following widgets are mainly used for organizing and grouping various basic and primitive widgets into more complex applications and dialogs:
We have seen the implementation of few of the built-in widgets given in the preceding table in our previous chapters. One of the greatest strengths of PySide lies in the ease of creation of customized widgets. We can group together some of the basic widgets to create a customized widget on our own. Before we could do that, we also have several ways to customize a widget to suit our needs. The basic form of customization is to change the properties of the existing widget. We can also opt to use stylesheets to customize the widget's appearance and some aspects of its behavior. In some cases, it is highly likely that we may require a widget that is different from any of the standard widgets. In those cases, we can subclass QWidget
directly and can completely define the behavior and appearance of the widget ourselves. In the example that follows this text, we create a customized "Analog Clock" widget and demonstrate how to create custom widgets.