вот фрагмент формы
class resultScreen(QMainWindow, Ui_resultWindow): def __init__(self, parent=None): super(resultScreen, self).__init__(parent) self.setupUi(self) print "!!" query1 = QSqlQuery() query1.exec_("SELECT post_id FROM fb_data") query1.exec_("SELECT shares FROM fb_data") while query1.next(): print query1.value(0).toString() self.selectRec.addItem(query1.value(0).toString()) self.labelPageid.setText(query1.value(0).toString()) def showResult(self): w.hide() self.show() self.connect(self, SIGNAL("destroyed()"), self.restoreScreen) def restoreScreen(self): w.show() def event(self, event): if event.type() == QEvent.Hide: self.restoreScreen() return QMainWindow.event(self, event)