Author: jamest
Date: 2007-01-09 14:36:17 -0600 (Tue, 09 Jan 2007)
New Revision: 9246

Modified:
   trunk/gnue-forms/src/uidrivers/qt3/widgets/image.py
Log:
added scrollable viewport to images under qt3 driver


Modified: trunk/gnue-forms/src/uidrivers/qt3/widgets/image.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/qt3/widgets/image.py 2007-01-09 20:31:17 UTC 
(rev 9245)
+++ trunk/gnue-forms/src/uidrivers/qt3/widgets/image.py 2007-01-09 20:36:17 UTC 
(rev 9246)
@@ -66,12 +66,15 @@
         parent = event.container
 
         (min_w, min_h) = self.get_default_size()
-        self.widget = qt.QLabel(parent)
+        self.widget = qt.QScrollView(parent)
         self.widget.setMinimumSize(min_w, min_h)
-
+        
+        image = qt.QLabel(self.widget)
+        self.widget.addChild(image)
+        
         self.getParent().add_widgets(self, spacer)
 
-        return self.widget
+        return image
 
 
     # -------------------------------------------------------------------------
@@ -137,20 +140,24 @@
             scalex = float (scrx) / imgx
             scaley = float (scry) / imgy
         else:
-            # TODO: is there something like a ScrollWindow ?
-            pass
-
+            self.widget.resizeContents(imgx, imgy)
+        
         if scalex != 1 or scaley != 1:
             value = value.resize ((abs(int(imgx * scalex)),
                 abs(int(imgy * scaley))), PILImage.BICUBIC)
 
         # Convert the PIL Image to a QPixmap
         # TODO: find a better way than using StringIO
+        # Note: the PIL 1.1.6 release contains ImageQT
+        #       which allows direct convertion into qt4
+        #       compatible objects via ImageQt.ImageQt(PILimage)
+        #
         f = cStringIO.StringIO()
         value.save(f, 'PNG')
         pxm = qt.QPixmap()
         pxm.loadFromData(f.getvalue())
         widget.setPixmap(pxm)
+        pxmSize = pxm.size()
 
 # =============================================================================
 # Configuration data



_______________________________________________
commit-gnue mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/commit-gnue

Reply via email to