аватар question@mail.ru · 01.01.1970 03:00

How does Qscrollarea work?

Please explain how you can work with qscrollarea . He did in the designer, but does not work. I did not find normal solutions on the Inteet

аватар answer@mail.ru · 01.01.1970 03:00

This is a widget-contener for widgets, whose size is usually very large and that the window with them fit, the holes (sliders) are added.

for placing widgets in qscrollarea Need not layout (composer), but a widget, therefore, a widget, therefore, a widget, therefore, a widget, therefore, a widget, so She has a method setwidget

. Pyqt5.qtwidgets Import qpplication, qgridlayout, qpushbutton, qscrollareaapp = qpplication ([]) layout = layouut = Qgridlayout () for i in range ( 10 ): for j in range ( 5 ): baton = qpushbutton ( f '> f' {i} x {j} ') layout.addwidget (button, i, j) w = qwidget () w.setlaout (layout) mw = Qscrollarea () mw.setwidget (w) mw.resize ( 200 , 200 ) mw.show () app. exec ()

the window will look like this:

with an increase in the size of the slider window They will disappear:


qscrollarea can change the size of the widgets in it, stretch them. A property that is by default false

if qscrollarea is the property to activate ( mw.setwidgethesizable (True)). Stretch:

Latest

Similar