is a wonderful class to organize the work of the
signals and slots
dynamically created objects. For example, the dynamically created buttons or objects in
This was particularly true in older versions of the software, that is, and relied on
which signals and slots system was based on the use of macros. But in the current realities of the new syntax in the indexes is much more convenient, and also supports a lambda function that can afford and does get rid of the application
which will look like a monstrous throwback to new projects that use the latest version of the
And when you consider more and congestion
then it does with
code even more terrible, if used to connect signals and slots with the use of pointers, since it is necessary to cast the signals and slots, but more on that later.
Therefore, let us consider a small project that will be based on the example of the official documentation of Qt. Namely, an example will next. We have
. By pressing a button in the Vertical Layout will be added to other dynamic buttons, by clicking on which QLabel will display the text from the button number in the following form: "Button 2". In the following figure shows an example of the application whose appearance will not differ, while the software implementations of the code will be a few.