0

I need to list a bunch of custom widgets in a scrolling area.

I would normally just use QListWidget, but that does not do smooth scrolling, which for me is a necessity. I found this question about smooth scrolling in a QListWidget, but when I try that solution, I get an error saying QListWidget.updateGeometries() requires at least one parameter!

I also thought about using a QScrollArea with multiple widgets in it, but it seems there is no way to do this. If I use a layout, the widgets inside resize. If I set multiple widgets as the child of a QWidget, then put that QWidget as the widget for my QScrollArea (as suggested here), only the last widget I set as a child of my QWidget shows up.

I might well be doing something wrong, as I am not very familiar with widget parenting, so maybe that's my problem. I don't know:

class EditDialog(QDialog):
    def __init__(self):
        super(EditDialog,self).__init__()

        self.scroller = QScrollArea()
        self.form = QWidget()
        self.form.setStyleSheet()
        self.lab = QLabel(self.form)
        self.lab.setText("Label")
        self.edit = QLineEdit(self.form)
        self.edit.setText("LineEdit")
        self.but = QPushButton("PushButton",self.form)
        self.scroller.setWidget(self.form)

        self.layout = QVBoxLayout()
        self.layout.addWidget(self.scroller)
        self.setLayout(self.layout)

        self.setWindowTitle(widget + " - StyleWise")
        self.exec_()

With this code, the QListWidget scrolls 100 pixels at a time, but I want it to scroll 1 or 2 at a time. I don't know what to do!

Community
  • 1
  • 1
KFox
  • 1,166
  • 3
  • 10
  • 35

0 Answers0