Here's my class:
class ChildFoundDlg(QDialog):
#__init__ function:
def __init__(self, parent=None):
QtGui.QDialog.__init__(self, parent)
self.resize(500, 270)
self.setMaximumSize(500, 540)
self.GridLayout = QtGui.QGridLayout(self)
def buttons(self, a, b, c): #a = 0, b = 5 c = 7
self.font = QtGui.QFont("Sans Serif", 10, QFont.Normal)
self.label = QtGui.QLabel(self)
self.label.setText(QtGui.QApplication.translate("Form", "Μήπως εννοείτε την/τον:", None, QtGui.QApplication.UnicodeUTF8))
self.label.setFont(self.font)
self.GridLayout.addWidget(self.label, a, 0, 1, 1)
self.label2 = QtGui.QLabel(self)
self.GridLayout.addWidget(self.label2, a, 1, 1, 1)
self.label2.setFont(self.font)
self.pushButton = QtGui.QPushButton(self)
self.GridLayout.addWidget(self.pushButton, b, 0, 2, 1)
self.pushButton.setText(QtGui.QApplication.translate("Form", "Υπότροπος", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding)
self.pushButton2 = QtGui.QPushButton(self)
self.GridLayout.addWidget(self.pushButton2, b, 1, 2, 1)
self.pushButton2.setText(QtGui.QApplication.translate("Form", "Αναβολή", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton2.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding)
self.pushButton3 = QtGui.QPushButton(self)
self.GridLayout.addWidget(self.pushButton3, c, 1, 2, 1)
self.pushButton3.setText(QtGui.QApplication.translate("Form", "Ακύρωση", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton3.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding)
self.pushButton3.clicked.connect(self.reject)
What I want to achieve is that, when I call self.buttons many times with different values, when the maximum size of the dialog is reached, stop enlarging but instead put scrollbars, if you understand what I'm saying... How can I do that?
Here is an example using a
QScrollArea
: