pyqt: Lower dock widget

I am trying to find a way to lower a dock widget so just the title bar is showing. Right now I am just trying to hide the widget inside the dock widget but I am getting this:

在这里输入图像描述

the dock widget "lowers" but the width doesn't stretch across the whole screen, is there a way I can fix that? Or some other way of lowering a dock widget?

Here is the code for the window:

class Ui_MainWindow(object):

    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(320, 240)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        MainWindow.setCentralWidget(self.centralwidget)


        self.dockWidget = QtGui.QDockWidget(MainWindow)
        self.dockWidget.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures)
        self.dockWidget.setObjectName(_fromUtf8("dockWidget"))
        self.dockWidget.setAllowedAreas(Qt.BottomDockWidgetArea)


        self.textEdit = QtGui.QTextEdit()
        self.textEdit.setGeometry(QtCore.QRect(40, 10, 104, 71))
        self.textEdit.setObjectName(_fromUtf8("textEdit"))
        self.textEdit.setReadOnly(True)

        self.dockWidget.setWidget(self.textEdit)
        self.textEdit.setVisible(False)

        MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(8), self.dockWidget)



        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)


    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None))
链接地址: http://www.djcxy.com/p/77412.html

上一篇: PyQt:在Widget中检测调整大小

下一篇: pyqt:较低的码头小部件