I designed a main window that contains 1 tableView and 3 dockWidgets.<br><br>If I use it on top of other windows, it works fine.<br><br>If I let it under other windows, when recall it on top, I find the 3 dockWidget gone (they automatically closed), and if I reopen them manually (through a menu action) they come up correctly and I find all the text that my application output meanwhile into them.<br>
<br>Why does this happen?<br>What did I do wrong?<br><br>I found out that this behaviour doesn't depend on my application.<br>If I just run the window alone (only the ui file, I mean) I get a similar behaviour.<br>1) I run the script and I get 1 tableView and 3 dockWidgets<br>
2) I minimize the window<br>3) I reopen the window and the 3 dockWidgets are gone.<br><br>Please help.<br><br>This is my pyui file:<br><br>from PyQt4 import QtCore, QtGui<br><br>class Ui_MainWindow(object):<br> def setupUi(self, MainWindow):<br>
MainWindow.setObjectName("MainWindow")<br> MainWindow.resize(QtCore.QSize(QtCore.QRect(0,0,800,600).size()).expandedTo(MainWindow.minimumSizeHint()))<br><br> self.centralwidget = QtGui.QWidget(MainWindow)<br>
self.centralwidget.setObjectName("centralwidget")<br><br> self.gridlayout = QtGui.QGridLayout(self.centralwidget)<br> self.gridlayout.setObjectName("gridlayout")<br><br> self.splitter = QtGui.QSplitter(self.centralwidget)<br>
self.splitter.setOrientation(QtCore.Qt.Vertical)<br> self.splitter.setObjectName("splitter")<br><br> self.tvLog = QtGui.QTableView(self.splitter)<br> self.tvLog.setSortingEnabled(True)<br>
self.tvLog.setObjectName("tvLog")<br><br> self.dockWidget_log = QtGui.QDockWidget(self.splitter)<br> self.dockWidget_log.setObjectName("dockWidget_log")<br><br> self.dockWidgetContents_log = QtGui.QWidget(self.dockWidget_log)<br>
self.dockWidgetContents_log.setObjectName("dockWidgetContents_log")<br><br> self.gridlayout1 = QtGui.QGridLayout(self.dockWidgetContents_log)<br> self.gridlayout1.setObjectName("gridlayout1")<br>
<br> self.textBrowser_log = QtGui.QTextBrowser(self.dockWidgetContents_log)<br><br> font = QtGui.QFont()<br> font.setFamily("Monospace")<br> self.textBrowser_log.setFont(font)<br> self.textBrowser_log.setLineWrapMode(QtGui.QTextEdit.NoWrap)<br>
self.textBrowser_log.setTabStopWidth(255)<br> self.textBrowser_log.setAcceptRichText(False)<br> self.textBrowser_log.setOpenLinks(False)<br> self.textBrowser_log.setObjectName("textBrowser_log")<br>
self.gridlayout1.addWidget(self.textBrowser_log,0,0,1,1)<br> self.dockWidget_log.setWidget(self.dockWidgetContents_log)<br><br> self.dockWidget_out = QtGui.QDockWidget(self.splitter)<br> self.dockWidget_out.setObjectName("dockWidget_out")<br>
<br> self.dockWidgetContents_err_2 = QtGui.QWidget(self.dockWidget_out)<br> self.dockWidgetContents_err_2.setObjectName("dockWidgetContents_err_2")<br><br> self.gridlayout2 = QtGui.QGridLayout(self.dockWidgetContents_err_2)<br>
self.gridlayout2.setObjectName("gridlayout2")<br><br> self.textEdit_out = QtGui.QTextEdit(self.dockWidgetContents_err_2)<br> self.textEdit_out.setLineWrapMode(QtGui.QTextEdit.NoWrap)<br> self.textEdit_out.setReadOnly(True)<br>
self.textEdit_out.setObjectName("textEdit_out")<br> self.gridlayout2.addWidget(self.textEdit_out,0,0,1,1)<br> self.dockWidget_out.setWidget(self.dockWidgetContents_err_2)<br><br> self.dockWidget_err = QtGui.QDockWidget(self.splitter)<br>
self.dockWidget_err.setObjectName("dockWidget_err")<br><br> self.dockWidgetContents_err = QtGui.QWidget(self.dockWidget_err)<br> self.dockWidgetContents_err.setObjectName("dockWidgetContents_err")<br>
<br> self.gridlayout3 = QtGui.QGridLayout(self.dockWidgetContents_err)<br> self.gridlayout3.setObjectName("gridlayout3")<br><br> self.textEdit_err = QtGui.QTextEdit(self.dockWidgetContents_err)<br>
self.textEdit_err.setLineWrapMode(QtGui.QTextEdit.NoWrap)<br> self.textEdit_err.setReadOnly(True)<br> self.textEdit_err.setObjectName("textEdit_err")<br> self.gridlayout3.addWidget(self.textEdit_err,0,0,1,1)<br>
self.dockWidget_err.setWidget(self.dockWidgetContents_err)<br> self.gridlayout.addWidget(self.splitter,0,0,1,1)<br> MainWindow.setCentralWidget(self.centralwidget)<br><br> self.menubar = QtGui.QMenuBar(MainWindow)<br>
self.menubar.setGeometry(QtCore.QRect(0,0,800,29))<br> self.menubar.setObjectName("menubar")<br><br> self.menuTask = QtGui.QMenu(self.menubar)<br> self.menuTask.setObjectName("menuTask")<br>
<br> self.menuLogging = QtGui.QMenu(self.menubar)<br> self.menuLogging.setObjectName("menuLogging")<br><br> self.menuAdd_handler = QtGui.QMenu(self.menuLogging)<br> self.menuAdd_handler.setObjectName("menuAdd_handler")<br>
<br> self.menuStart_log_msg = QtGui.QMenu(self.menuLogging)<br> self.menuStart_log_msg.setObjectName("menuStart_log_msg")<br><br> self.menuHelp = QtGui.QMenu(self.menubar)<br> self.menuHelp.setObjectName("menuHelp")<br>
<br> self.menuView = QtGui.QMenu(self.menubar)<br> self.menuView.setObjectName("menuView")<br> MainWindow.setMenuBar(self.menubar)<br><br> self.statusbar = QtGui.QStatusBar(MainWindow)<br>
self.statusbar.setObjectName("statusbar")<br> MainWindow.setStatusBar(self.statusbar)<br><br> self.actionExit = QtGui.QAction(MainWindow)<br> self.actionExit.setObjectName("actionExit")<br>
<br> self.actionStop = QtGui.QAction(MainWindow)<br> self.actionStop.setObjectName("actionStop")<br><br> self.actionRemove_handler = QtGui.QAction(MainWindow)<br> self.actionRemove_handler.setObjectName("actionRemove_handler")<br>
<br> self.actionAbout = QtGui.QAction(MainWindow)<br> self.actionAbout.setObjectName("actionAbout")<br><br> self.actionStd_output = QtGui.QAction(MainWindow)<br> self.actionStd_output.setCheckable(True)<br>
self.actionStd_output.setObjectName("actionStd_output")<br><br> self.actionStd_error = QtGui.QAction(MainWindow)<br> self.actionStd_error.setCheckable(True)<br> self.actionStd_error.setObjectName("actionStd_error")<br>
<br> self.actionFile = QtGui.QAction(MainWindow)<br> self.actionFile.setCheckable(True)<br> self.actionFile.setObjectName("actionFile")<br><br> self.actionCircular_file = QtGui.QAction(MainWindow)<br>
self.actionCircular_file.setCheckable(True)<br> self.actionCircular_file.setObjectName("actionCircular_file")<br><br> self.actionCyclic_file = QtGui.QAction(MainWindow)<br> self.actionCyclic_file.setCheckable(True)<br>
self.actionCyclic_file.setObjectName("actionCyclic_file")<br><br> self.actionLog_server = QtGui.QAction(MainWindow)<br> self.actionLog_server.setCheckable(True)<br> self.actionLog_server.setObjectName("actionLog_server")<br>
<br> self.actionLog_widget = QtGui.QAction(MainWindow)<br> self.actionLog_widget.setChecked(False)<br> self.actionLog_widget.setObjectName("actionLog_widget")<br><br> self.actionError_widget = QtGui.QAction(MainWindow)<br>
self.actionError_widget.setChecked(False)<br> self.actionError_widget.setObjectName("actionError_widget")<br><br> self.actionOutput_widget = QtGui.QAction(MainWindow)<br> self.actionOutput_widget.setObjectName("actionOutput_widget")<br>
<br> self.actionStd_output_v = QtGui.QAction(MainWindow)<br> self.actionStd_output_v.setCheckable(True)<br> self.actionStd_output_v.setChecked(True)<br> self.actionStd_output_v.setObjectName("actionStd_output_v")<br>
<br> self.actionStd_error_v = QtGui.QAction(MainWindow)<br> self.actionStd_error_v.setCheckable(True)<br> self.actionStd_error_v.setChecked(True)<br> self.actionStd_error_v.setObjectName("actionStd_error_v")<br>
<br> self.actionLogging_v = QtGui.QAction(MainWindow)<br> self.actionLogging_v.setCheckable(True)<br> self.actionLogging_v.setChecked(True)<br> self.actionLogging_v.setObjectName("actionLogging_v")<br>
<br> self.actionStdOutput = QtGui.QAction(MainWindow)<br> self.actionStdOutput.setCheckable(True)<br> self.actionStdOutput.setObjectName("actionStdOutput")<br><br> self.actionStdError = QtGui.QAction(MainWindow)<br>
self.actionStdError.setCheckable(True)<br> self.actionStdError.setObjectName("actionStdError")<br><br> self.actionDebug = QtGui.QAction(MainWindow)<br> self.actionDebug.setObjectName("actionDebug")<br>
<br> self.actionInfo = QtGui.QAction(MainWindow)<br> self.actionInfo.setObjectName("actionInfo")<br><br> self.actionWarning = QtGui.QAction(MainWindow)<br> self.actionWarning.setObjectName("actionWarning")<br>
<br> self.actionError = QtGui.QAction(MainWindow)<br> self.actionError.setObjectName("actionError")<br><br> self.actionFault = QtGui.QAction(MainWindow)<br> self.actionFault.setObjectName("actionFault")<br>
<br> self.actionCustom = QtGui.QAction(MainWindow)<br> self.actionCustom.setObjectName("actionCustom")<br><br> self.actionLog_log = QtGui.QAction(MainWindow)<br> self.actionLog_log.setCheckable(True)<br>
self.actionLog_log.setObjectName("actionLog_log")<br><br> self.actionTrace = QtGui.QAction(MainWindow)<br> self.actionTrace.setObjectName("actionTrace")<br><br> self.actionFile_v = QtGui.QAction(MainWindow)<br>
self.actionFile_v.setCheckable(True)<br> self.actionFile_v.setObjectName("actionFile_v")<br><br> self.actionStart_server = QtGui.QAction(MainWindow)<br> self.actionStart_server.setCheckable(True)<br>
self.actionStart_server.setObjectName("actionStart_server")<br> self.menuTask.addAction(self.actionStart_server)<br> self.menuTask.addSeparator()<br> self.menuTask.addAction(self.actionExit)<br>
self.menuTask.addSeparator()<br> self.menuAdd_handler.addAction(self.actionLog_log)<br> self.menuAdd_handler.addAction(self.actionStdOutput)<br> self.menuAdd_handler.addAction(self.actionStdError)<br>
self.menuAdd_handler.addSeparator()<br> self.menuAdd_handler.addAction(self.actionFile)<br> self.menuAdd_handler.addAction(self.actionCircular_file)<br> self.menuAdd_handler.addAction(self.actionCyclic_file)<br>
self.menuAdd_handler.addSeparator()<br> self.menuAdd_handler.addAction(self.actionLog_server)<br> self.menuStart_log_msg.addAction(self.actionTrace)<br> self.menuStart_log_msg.addAction(self.actionDebug)<br>
self.menuStart_log_msg.addAction(self.actionInfo)<br> self.menuStart_log_msg.addAction(self.actionWarning)<br> self.menuStart_log_msg.addAction(self.actionError)<br> self.menuStart_log_msg.addAction(self.actionFault)<br>
self.menuStart_log_msg.addAction(self.actionCustom)<br> self.menuLogging.addAction(self.menuAdd_handler.menuAction())<br> self.menuLogging.addSeparator()<br> self.menuLogging.addAction(self.menuStart_log_msg.menuAction())<br>
self.menuLogging.addAction(self.actionStop)<br> self.menuHelp.addAction(self.actionAbout)<br> self.menuView.addAction(self.actionStd_output_v)<br> self.menuView.addAction(self.actionStd_error_v)<br>
self.menuView.addAction(self.actionLogging_v)<br> self.menuView.addAction(self.actionFile_v)<br> self.menubar.addAction(self.menuTask.menuAction())<br> self.menubar.addAction(self.menuLogging.menuAction())<br>
self.menubar.addAction(self.menuView.menuAction())<br> self.menubar.addAction(self.menuHelp.menuAction())<br><br> self.retranslateUi(MainWindow)<br> QtCore.QObject.connect(self.actionExit,QtCore.SIGNAL("triggered()"),MainWindow.close)<br>
QtCore.QObject.connect(self.actionStd_error_v,QtCore.SIGNAL("toggled(bool)"),self.dockWidget_err.setVisible)<br> QtCore.QObject.connect(self.actionStd_output_v,QtCore.SIGNAL("toggled(bool)"),self.dockWidget_out.setVisible)<br>
QtCore.QObject.connect(self.actionLogging_v,QtCore.SIGNAL("toggled(bool)"),self.dockWidget_log.setVisible)<br> QtCore.QObject.connect(self.dockWidget_err,QtCore.SIGNAL("visibilityChanged(bool)"),self.actionStd_error_v.setChecked)<br>
QtCore.QObject.connect(self.dockWidget_log,QtCore.SIGNAL("visibilityChanged(bool)"),self.actionLogging_v.setChecked)<br> QtCore.QObject.connect(self.dockWidget_out,QtCore.SIGNAL("visibilityChanged(bool)"),self.actionStd_output_v.setChecked)<br>
QtCore.QMetaObject.connectSlotsByName(MainWindow)<br><br> def retranslateUi(self, MainWindow):<br> MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "TW-logging system", None, QtGui.QApplication.UnicodeUTF8))<br>
self.dockWidget_log.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Log", None, QtGui.QApplication.UnicodeUTF8))<br> self.dockWidget_out.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Output", None, QtGui.QApplication.UnicodeUTF8))<br>
self.dockWidget_err.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Error", None, QtGui.QApplication.UnicodeUTF8))<br> self.menuTask.setTitle(QtGui.QApplication.translate("MainWindow", "Task", None, QtGui.QApplication.UnicodeUTF8))<br>
self.menuLogging.setTitle(QtGui.QApplication.translate("MainWindow", "Logging", None, QtGui.QApplication.UnicodeUTF8))<br> self.menuAdd_handler.setTitle(QtGui.QApplication.translate("MainWindow", "Add/remove handler", None, QtGui.QApplication.UnicodeUTF8))<br>
self.menuStart_log_msg.setTitle(QtGui.QApplication.translate("MainWindow", "Start periodic log msg", None, QtGui.QApplication.UnicodeUTF8))<br> self.menuHelp.setTitle(QtGui.QApplication.translate("MainWindow", "Help", None, QtGui.QApplication.UnicodeUTF8))<br>
self.menuView.setTitle(QtGui.QApplication.translate("MainWindow", "View", None, QtGui.QApplication.UnicodeUTF8))<br> self.actionExit.setText(QtGui.QApplication.translate("MainWindow", "Exit", None, QtGui.QApplication.UnicodeUTF8))<br>
self.actionStop.setText(QtGui.QApplication.translate("MainWindow", "Stop all periodic log msg", None, QtGui.QApplication.UnicodeUTF8))<br> self.actionRemove_handler.setText(QtGui.QApplication.translate("MainWindow", "Remove handler", None, QtGui.QApplication.UnicodeUTF8))<br>
self.actionAbout.setText(QtGui.QApplication.translate("MainWindow", "About", None, QtGui.QApplication.UnicodeUTF8))<br> self.actionStd_output.setText(QtGui.QApplication.translate("MainWindow", "std output", None, QtGui.QApplication.UnicodeUTF8))<br>
self.actionStd_error.setText(QtGui.QApplication.translate("MainWindow", "std error", None, QtGui.QApplication.UnicodeUTF8))<br> self.actionFile.setText(QtGui.QApplication.translate("MainWindow", "file", None, QtGui.QApplication.UnicodeUTF8))<br>
self.actionCircular_file.setText(QtGui.QApplication.translate("MainWindow", "circular file", None, QtGui.QApplication.UnicodeUTF8))<br> self.actionCyclic_file.setText(QtGui.QApplication.translate("MainWindow", "cyclic file", None, QtGui.QApplication.UnicodeUTF8))<br>
self.actionLog_server.setText(QtGui.QApplication.translate("MainWindow", "log server", None, QtGui.QApplication.UnicodeUTF8))<br> self.actionLog_widget.setText(QtGui.QApplication.translate("MainWindow", "log widget", None, QtGui.QApplication.UnicodeUTF8))<br>
self.actionError_widget.setText(QtGui.QApplication.translate("MainWindow", "error widget", None, QtGui.QApplication.UnicodeUTF8))<br> self.actionOutput_widget.setText(QtGui.QApplication.translate("MainWindow", "output widget", None, QtGui.QApplication.UnicodeUTF8))<br>
self.actionStd_output_v.setText(QtGui.QApplication.translate("MainWindow", "std output", None, QtGui.QApplication.UnicodeUTF8))<br> self.actionStd_error_v.setText(QtGui.QApplication.translate("MainWindow", "std error", None, QtGui.QApplication.UnicodeUTF8))<br>
self.actionLogging_v.setText(QtGui.QApplication.translate("MainWindow", "logging", None, QtGui.QApplication.UnicodeUTF8))<br> self.actionStdOutput.setText(QtGui.QApplication.translate("MainWindow", "stdOutput", None, QtGui.QApplication.UnicodeUTF8))<br>
self.actionStdError.setText(QtGui.QApplication.translate("MainWindow", "stdError", None, QtGui.QApplication.UnicodeUTF8))<br> self.actionDebug.setText(QtGui.QApplication.translate("MainWindow", "debug", None, QtGui.QApplication.UnicodeUTF8))<br>
self.actionInfo.setText(QtGui.QApplication.translate("MainWindow", "info", None, QtGui.QApplication.UnicodeUTF8))<br> self.actionWarning.setText(QtGui.QApplication.translate("MainWindow", "warning", None, QtGui.QApplication.UnicodeUTF8))<br>
self.actionError.setText(QtGui.QApplication.translate("MainWindow", "error", None, QtGui.QApplication.UnicodeUTF8))<br> self.actionFault.setText(QtGui.QApplication.translate("MainWindow", "critical", None, QtGui.QApplication.UnicodeUTF8))<br>
self.actionCustom.setText(QtGui.QApplication.translate("MainWindow", "custom", None, QtGui.QApplication.UnicodeUTF8))<br> self.actionLog_log.setText(QtGui.QApplication.translate("MainWindow", "log window", None, QtGui.QApplication.UnicodeUTF8))<br>
self.actionTrace.setText(QtGui.QApplication.translate("MainWindow", "trace", None, QtGui.QApplication.UnicodeUTF8))<br> self.actionFile_v.setText(QtGui.QApplication.translate("MainWindow", "file", None, QtGui.QApplication.UnicodeUTF8))<br>
self.actionStart_server.setText(QtGui.QApplication.translate("MainWindow", "Start server", None, QtGui.QApplication.UnicodeUTF8))<br><br><br><br>if __name__ == "__main__":<br> import sys<br>
app = QtGui.QApplication(sys.argv)<br> MainWindow = QtGui.QMainWindow()<br> ui = Ui_MainWindow()<br> ui.setupUi(MainWindow)<br> MainWindow.show()<br> sys.exit(app.exec_())<br><br>