def sizeHint(self): hint = QLabel.sizeHint(self) width, height = hint.width(), hint.height() angle = self.angle * pi / 180 rotated_width = abs(width * cos(angle)) + abs(height * sin(angle)) rotated_height = abs(width * sin(angle)) + abs(height * cos(angle)) return QSize(rotated_width, rotated_height)
def sizeHint(self): hint = QLabel.sizeHint(self) width, height = hint.width(), hint.height() angle = self.angle*pi/180 rotated_width = abs(width*cos(angle))+abs(height*sin(angle)) rotated_height = abs(width*sin(angle))+abs(height*cos(angle)) return QSize(rotated_width, rotated_height)