我在应用程序中有一个对话框,该对话框作为菜单时间打开。对话框/窗口从用户那里获取一些输入,并花费一些时间来处理输出。尽管在我按下“确定”按钮后,该窗口似乎被禁用,但它确实显示为处于活动状态。如何将对话框(窗口)显示为灰色,以便用户可见,但用户知道正在运行某些进程
我有一个Python UI文件,从中继承了DoSomethingDialog的GUI元素
class DoSomethingDialog(QtGui.QDialog, myapp.ui.do_something.Ui_Dialog):
def __init__(self, parent=None):
super(DoSomethingDialog, self).__init__(parent)
self.setupUi(self)
self.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), self.button_box_ok_click)
def button_box_ok_click(self):
# processing happens here
....
....
self.close()
def run():
app = QtGui.QApplication(sys.argv)
form = DoSomethingDialog()
form.show()
sys.exit(app.exec_())
if __name__ == "__main__":
run()
class MainWindow(QtGui.QMainWindow, main_window.Ui_myapp):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.setupUi(self)
self.actionDoSomething.connect(self.actionDoSomething, QtCore.SIGNAL("triggered()"),
self.open_do_something_dialog)
def open_do_something_dialog(self):
self.ui = DoSomethingDialog()
self.ui.show()
if __name__ == '__main__':
import sys
from myapp import app
sys.exit(app.run())