Scale the image into the Intro page.
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 31 May 2010 09:43:27 +0000 (09:43 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 31 May 2010 09:43:27 +0000 (09:43 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3883 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/BIntroPage.py
wizard/ui/intro_page.ui

index 764d56173c8ca2e70956b87ba57864e34e44c041..6352d20e83cf24572bcf764359ced3decfe04399 100644 (file)
@@ -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.
     """
     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!"))
     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):
     ## Overloaded QWizardPage methods ##
 
     def isComplete(self):
@@ -57,6 +70,14 @@ class BIntroPage(BWizardPage):
         Overload of the QWizardPage isComplete method.
         """
         return True
         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)
index 59c1328a96820fe83c079ee9b054227f26bb4ccf..28e22426a98ba5881444e42b6e2fef739ddc93f5 100644 (file)
   <property name="windowTitle">
    <string>Form</string>
   </property>
   <property name="windowTitle">
    <string>Form</string>
   </property>
-  <layout class="QVBoxLayout" name="verticalLayout" stretch="0,1,0">
+  <layout class="QVBoxLayout" name="verticalLayout" stretch="1,0,0">
    <item>
    <item>
-    <layout class="QHBoxLayout" name="horizontalLayout">
-     <property name="sizeConstraint">
-      <enum>QLayout::SetFixedSize</enum>
+    <widget class="QLabel" name="imageLabel">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
      </property>
      </property>
-     <item>
-      <spacer name="horizontalSpacer">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item>
-      <widget class="QLabel" name="imageLabel">
-       <property name="maximumSize">
-        <size>
-         <width>16777215</width>
-         <height>115</height>
-        </size>
-       </property>
-       <property name="text">
-        <string/>
-       </property>
-       <property name="pixmap">
-        <pixmap resource="../bertos.qrc">:/images/logo.png</pixmap>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <spacer name="horizontalSpacer_2">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-    </layout>
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>0</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>16777215</width>
+       <height>16777215</height>
+      </size>
+     </property>
+     <property name="text">
+      <string/>
+     </property>
+     <property name="pixmap">
+      <pixmap resource="../bertos.qrc">:/images/logo.png</pixmap>
+     </property>
+     <property name="scaledContents">
+      <bool>false</bool>
+     </property>
+     <property name="alignment">
+      <set>Qt::AlignCenter</set>
+     </property>
+    </widget>
    </item>
    <item>
     <widget class="QLabel" name="introLabel">
    </item>
    <item>
     <widget class="QLabel" name="introLabel">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize">
+      <size>
+       <width>429</width>
+       <height>200</height>
+      </size>
+     </property>
      <property name="text">
       <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
 &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
      <property name="text">
       <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
 &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
@@ -89,7 +86,7 @@ p, li { white-space: pre-wrap; }
      <property name="sizeHint" stdset="0">
       <size>
        <width>20</width>
      <property name="sizeHint" stdset="0">
       <size>
        <width>20</width>
-       <height>39</height>
+       <height>10</height>
       </size>
      </property>
     </spacer>
       </size>
      </property>
     </spacer>