Unsolved How to use a QScrollArea
-
Hello, I want to put a QScrollArea with an Horizontal ScrollBar but I don't know how to do it.
Can someone explain it to me? -
Just add your widget to your scrollArea. The scrollBar should appear automatically.
-
@Pl45m4
I tried but, no scroll bar and it doesn't resize :/
-
Where is that widget? It looks like a toolBar?
How you've added your content? -
@Pl45m4 they are pushbuttons, and I dragged them in the scrollarea
-
-
@Pl45m4 Nope, in Qt Creator. Ok I'll try.
-
@HenkCoder If you are going to add multiple items then do the following:
- Add to QScrollArea.
- Place the QPushButton (or other widgets) inside the QScrollArea
- Add a layout inside the QScrollArea.
-
@eyllanesc Hey, how do I add a layout inside of it?
-
@HenkCoder kindly be patient and study about Layout management here.
... https://realpython.com/python-pyqt-layout/Practice the examples, you will understand better.
For example:class FirstApp(QWidget): def__init__(*write your function*) Thereafter, for your scrollarea, grid = QGridLayout() gbox = QGroupBox() gbox.setCheckable(True) vbox = QVBoxLayout() self.setLayout(grid) grid.addWidget(gbox) gbox.setLayout(vbox) surname = QLabel("Surname:") vbox.addWidget(surname) scroll = QSCrollArea() scroll.setVerticalScrollPolicy(...) scroll.setHorizontalScrollPolicy(...) scroll.setResizePolicy(True) scroll.setWidget(gbox) grid.addWidget(scroll)
-
@CEO hey sorry but I'm not using PyQt
-
@HenkCoder said in How to use a QScrollArea:
sorry but I'm not using PyQt