Hi,

  The QPushButton I added does not stay inside of a scroll area, where am I
calling the API wrongly ?

import sys
from PySide2 import QtWidgets, QtCore

class Example(QtWidgets.QWidget):
def __init__(self):
super(Example, self).__init__()
self.initUI()
def initUI(self):
scroll = QtWidgets.QScrollArea()
scroll.setWidgetResizable(True)
vbox = QtWidgets.QVBoxLayout()
vbox.setAlignment(QtCore.Qt.AlignTop)
scroll.setLayout(vbox)
vbox.addStretch(1)
for index in range(20):
vbox.addWidget(QtWidgets.QPushButton('button {}'.format(index)))
self.setLayout(vbox)
self.setGeometry(300, 300, 300, 150)
self.setWindowTitle('Buttons')
self.show()
def main():
app = QtWidgets.QApplication(sys.argv)
ex = Example()
ex.show()
sys.exit(app.exec_())


if __name__ == '__main__':
main()

Cheers
-- 
Nicholas Yue
https://www.linkedin.com/in/nicholasyue/
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to