The parentheses of the QToolBox(parent,f) should be written by themselves. In addition, the need for interface, generally including Q_OBJECT class, which has signal slots and other things, the specific has not yet been fully understood.

Here we use a QGroupBox class.
QVBoxLayout
*
layout1
=
new
QVBoxLayout
(
groupBox1
Pass in this pointer to indicate that the following layout is in the groupbox. It can be understood by inferring the this pointer passed by the previous code. The previous this pointer window class, which placed the layout in the window, is confined to a grouvox, which is very understandable.

Of course, the final layout also needs to add these sub-layouts to the window layout.

The example here uses the additem method. It should be noted here that the drawer class inherits the QToolBox class, so this method is suitable. It's added at the bottom.