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