<div>Comment out the following two lines (what are they for?)</div><div><br></div>#self.mainWidget = QWidget()<br>#self.setCentralWidget(self.mainWidget)<br><br><div class="gmail_quote">On Mon, Aug 17, 2009 at 8:03 PM, Dan Davison <span dir="ltr"><<a href="mailto:davison@stats.ox.ac.uk">davison@stats.ox.ac.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">A beginners question. The code below sets up a main window with two dock<br>
widgets (which themselves contain tree/list widgets). However, when it<br>
starts up, there is an empty area between the two dock widgets (one is<br>
above, and one below). What is the correct way to set this up so that<br>
the two dock widgets expand vertically to fill all the space? (The<br>
commented out setMaximumSize calls didn't seem to have any effect).<br>
<br>
Thanks,<br>
<br>
Dan<br>
<br>
#!/usr/bin/env python<br>
import sys<br>
from PyQt4.QtCore import *<br>
from PyQt4.QtGui import *<br>
<br>
class MainWindow(QMainWindow):<br>
<br>
def __init__(self, parent=None):<br>
super(MainWindow, self).__init__(parent)<br>
self.mainWidget = QWidget()<br>
self.setCentralWidget(self.mainWidget)<br>
<br>
tdw = QDockWidget("top dock widget", self)<br>
tdw.setAllowedAreas(Qt.TopDockWidgetArea)<br>
tw = QTreeWidget()<br>
tdw.setWidget(tw)<br>
self.addDockWidget(Qt.TopDockWidgetArea, tdw)<br>
<br>
# dw.setMaximumSize(dw.maximumSize())<br>
<br>
bdw = QDockWidget("bottom dock widget", self)<br>
bdw.setAllowedAreas(Qt.BottomDockWidgetArea)<br>
lw = QListWidget()<br>
bdw.setWidget(lw)<br>
self.addDockWidget(Qt.BottomDockWidgetArea, bdw)<br>
<br>
# ldw.setMaximumSize(ldw.maximumSize())<br>
<br>
<br>
if __name__ == '__main__':<br>
app = QApplication(sys.argv)<br>
mainWindow = MainWindow()<br>
mainWindow.show()<br>
app.exec_()<br>
<br>
_______________________________________________<br>
PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br>
<a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Best Regards! devan.xu<br>