Eric Gach wrote: > Hi, > > There seems to be a problem with pyuic4 and generating the code when > using QDockWidget. There's a setting that can be seen in the Qt Designer > for QDockWidget that is called "docked". This isn't documented in the Qt > documentation for QDockWidget, which is why it gave me so much trouble. :) > > It seems that when this setting is true (or 1 in the XML output), it > calls the addDockWidget method of the window it's using to make sure the > dock widget is properly docked in the designated area. The pyuic4 > program doesn't seem to pick up on this and add it into the code > anywhere. I solved it myself by just adding this code: > > self.MainWindow.addDockWidget(QtCore.Qt.LeftDockWidgetArea, > self.ui.dockWidget) > > I added this into my class that uses the uic generated code. Other than > that, everything else seems to be working great! > > Thanks for the great work! > Eric Gach >
Hi, This just happens if the dock widget happens to be in a main window, which was not covered by my test suite. Here's a patch that should fix the problem, could you test it? best regards Torsten -- Torsten Marek <[EMAIL PROTECTED]> ID: A244C858 -- FP: 1902 0002 5DFC 856B F146 894C 7CC5 451E A244 C858 Keyserver: subkeys.pgp.net
=== modified file 'a/uic/Compiler/qtproxies.py'
--- a/uic/Compiler/qtproxies.py
+++ b/uic/Compiler/qtproxies.py
@@ -170,6 +170,8 @@
class Qt(ProxyClass):
class CursorShape(LiteralProxyClass):
module = "QtCore.Qt"
+ class DockWidgetArea(LiteralProxyClass):
+ module = "QtCore.Qt"
class QListWidgetItem(ProxyClass):
module = "QtGui"
=== modified file 'a/uic/uiparser.py'
--- a/uic/uiparser.py
+++ b/uic/uiparser.py
@@ -169,7 +169,10 @@
self.stack.topwidget.setMenuBar(widget)
elif isinstance(widget, QtGui.QStatusBar):
self.stack.topwidget.setStatusBar(widget)
-
+ elif isinstance(widget, QtGui.QDockWidget):
+ dwArea = self.wprops.getAttribute(elem, "dockWidgetArea")
+ self.stack.topwidget.addDockWidget(
+ QtCore.Qt.DockWidgetArea(dwArea), widget)
def createSpacer(self, elem):
width = int(elem.findtext("property/size/width"))
signature.asc
Description: OpenPGP digital signature
_______________________________________________ PyKDE mailing list [email protected] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
