def sizeHint(self, which, constraint=QRectF()): # type: (Qt.SizeHint, QSizeF) -> QSizeF pw = 1. sh = QSizeF() if which == Qt.MinimumSize: sh = QSizeF(pw, pw) elif which == Qt.PreferredSize: sh = QSizeF(pw, 30.) elif which == Qt.MaximumSize: sh = QSizeF(pw, QWIDGETSIZE_MAX) if self.__orientation == Qt.Horizontal: sh.transpose() # Qt4 compatible return sh