X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=wizard%2FBIntroPage.py;h=6352d20e83cf24572bcf764359ced3decfe04399;hb=4d907fd14c2fe774243ea65dce68f0592f881557;hp=764d56173c8ca2e70956b87ba57864e34e44c041;hpb=ed0d4c55052f6f98007ea0e91e6c90fe8809425a;p=bertos.git diff --git a/wizard/BIntroPage.py b/wizard/BIntroPage.py index 764d5617..6352d20e 100644 --- a/wizard/BIntroPage.py +++ b/wizard/BIntroPage.py @@ -45,11 +45,24 @@ class BIntroPage(BWizardPage): Initial page of the wizard. Permit to select the project name and the directory where the project will be created. """ - + def __init__(self): BWizardPage.__init__(self, UI_LOCATION + "/intro_page.ui") self.setTitle(self.tr("Welcome in BeRTOS Wizard!")) - + self.image = QPixmap(":/images/logo.png") + + ## Overloaded QWidget methods ## + + def resizeEvent(self, event): + self._scalePicture() + BWizardPage.resizeEvent(self, event) + + def showEvent(self, event): + self._scalePicture() + BWizardPage.showEvent(self, event) + + ## + ## Overloaded QWizardPage methods ## def isComplete(self): @@ -57,6 +70,14 @@ class BIntroPage(BWizardPage): Overload of the QWizardPage isComplete method. """ return True - + #### + def _scalePicture(self): + """ + I need this method because the scaledContent property of the QLabel + doesn't care the aspect ratio. + """ + label_size = self.pageContent.imageLabel.size() + scaled_image = self.image.scaled(label_size, Qt.KeepAspectRatio) + self.pageContent.imageLabel.setPixmap(scaled_image)