[PyQt] Support for QFormLayout

Dror Levin spatz at psybear.com
Mon May 26 19:17:21 BST 2008


An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20080526/125c8da7/attachment.html
-------------- next part --------------
diff -ur orig/qtproxies.py new/qtproxies.py
--- orig/qtproxies.py	2008-05-26 20:32:48.000000000 +0300
+++ new/qtproxies.py	2008-05-26 20:38:48.000000000 +0300
@@ -274,6 +274,7 @@
     class QGridLayout(QLayout): pass
     class QHBoxLayout(QLayout): pass
     class QVBoxLayout(QLayout): pass
+    class QFormLayout(QLayout): pass
     
     class QWidget(QtCore.QObject):
         def font(self):
diff -ur orig/uiparser.py new/uiparser.py
--- orig/uiparser.py	2008-05-26 20:33:03.000000000 +0300
+++ new/uiparser.py	2008-05-26 20:37:10.000000000 +0300
@@ -163,7 +163,10 @@
         widget = self.stack.popWidget()
         
         if self.stack.topIsLayout():
-            self.stack.peek().addWidget(widget, *elem.attrib["grid-position"])
+            if isinstance(self.stack.peek(), QtGui.QFormLayout):
+                self.stack.peek().setWidget(int(elem.attrib["row"]), QtGui.QFormLayout.FieldRole if int(elem.attrib["column"]) else QtGui.QFormLayout.LabelRole, widget)
+            else:
+                self.stack.peek().addWidget(widget, *elem.attrib["grid-position"])
 
             
         if isinstance(self.stack.topwidget, QtGui.QToolBox):


More information about the PyQt mailing list