From e0a19693a515af4ad45c94accf1d863bc07fad6d Mon Sep 17 00:00:00 2001 From: duplo Date: Mon, 31 May 2010 09:43:27 +0000 Subject: [PATCH] Scale the image into the Intro page. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3883 38d2e660-2303-0410-9eaa-f027e97ec537 --- wizard/BIntroPage.py | 27 ++++++++++-- wizard/ui/intro_page.ui | 93 ++++++++++++++++++++--------------------- 2 files changed, 69 insertions(+), 51 deletions(-) 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) diff --git a/wizard/ui/intro_page.ui b/wizard/ui/intro_page.ui index 59c1328a..28e22426 100644 --- a/wizard/ui/intro_page.ui +++ b/wizard/ui/intro_page.ui @@ -13,58 +13,55 @@ Form - + - - - QLayout::SetFixedSize + + + + 0 + 0 + - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 16777215 - 115 - - - - - - - :/images/logo.png - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + + + :/images/logo.png + + + false + + + Qt::AlignCenter + + + + + 0 + 0 + + + + + 429 + 200 + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> @@ -89,7 +86,7 @@ p, li { white-space: pre-wrap; } 20 - 39 + 10 -- 2.25.1