QT 中关闭窗口后 进程仍然存在
来源:互联网 发布:java默认构造器 编辑:程序博客网 时间:2024/04/28 12:07
本意是这个widget closed后程序应该正常退出
但实际上进程依然运行。
Qt中对app的退出默认为最后一个窗口关闭时自动退出
可以通过setQuitOnLastWindowClosed来更改
关于 close() 函数的文档
Closes this widget. Returns true if the widget was closed; otherwise returns false.
First it sends the widget a QCloseEvent. The widget is hidden if it accepts the close event. If it ignores the event, nothing happens. The default implementation of QWidget::closeEvent() accepts the close event.
If the widget has the Qt::WA_DeleteOnClose flag, the widget is also deleted. A close events is delivered to the widget no matter if the widget is visible or not.
The QApplication::lastWindowClosed() signal is emitted when the last visible primary window (i.e. window with no parent) with the Qt::WA_QuitOnClose attribute set is closed. By default this attribute is set for all widgets except transient windows such as splash screens, tool windows, and popup menus.
红色部分,当最后一个窗口关闭的时候会产生 QApplication::lastWindowClosed() 信号,而正是这个信号使程序退出。
但是在调用 windows.close() 的时候,程序并没有进入消息循环,而操作系统是消息响应的,
QApplication::lastWindowClosed() 信号所对应的槽应该不会被执行。
而等程序进入app.exec() 之后,永远没有 quit() 执行,相当于进入的死循环
而上面的代码为什么要在那个地方调用 close() 方法? (没有理由 纯属无聊)在进入app.exec() 之前,创建的 Widget 可以不用关闭,程序运行结束的时候会自动关闭
- QT 中关闭窗口后 进程仍然存在
- vc 关闭程序后任务管理器进程中进程仍然存在的解决方法
- vb.net 打开EXCEL ,关闭程序后,EXCEL进程仍然存在的问题
- ssh关闭后仍然运行当前进程
- 生产环境tomcat 在liunx系统中shutdown后进程仍然存在解决办法
- 生产环境tomcat 在liunx系统中shutdown后进程仍然存在解决办法
- 生产环境tomcat 在liunx系统中shutdown后进程仍然存在解决办法
- Qt中关闭窗口命令
- Qt窗口hide()后的关闭机制
- linux 关闭窗口后 进程结束 解决办法
- QT中关闭子窗口而不关闭父窗口
- 在MFC中 应用OpenCV 关闭主窗口后进程无法正常退出
- 关于tomcat7关闭(shutdown.sh)后进程依旧存在
- 关闭窗体后,进程仍然在运行的问题重现与解决
- qt中关闭窗口资源释放问题
- QT在构造函数中关闭窗口
- QT之QApplication的exit,quit调用后仍然显示窗口
- Qt::TOOL窗口关闭但进程仍在运行解决方案
- 治疗网瘾,宜堵还是宜疏?
- 该关注一下个人的健康了
- 重写Calendar类
- C++中全局变量的问题
- Zigbee休眠(cc2430)
- QT 中关闭窗口后 进程仍然存在
- 祝福大家情人节快乐
- import和__import__(8/27补充)
- ASAM MCD2D 笔记(1) - ODX use cases
- C# const和readonly的区别
- 一直在寻找php+mysql的时时彩平台源码
- 3.Java中的类和对象【第二章节草案】
- Java连接数据库的标准方式
- CERL: 用PHP或Python来做服务器