• 4281阅读
  • 2回复

窗口的关闭信号,是如何让主事件循环退出的?? [复制链接]

上一主题 下一主题
离线陈小草
 
只看楼主 倒序阅读 楼主  发表于: 2013-08-15
写了个MainWindow窗口
窗口关闭时,主循环即退出

但我想自己控制程序退出
怎么屏蔽窗口关闭信号到主事件循环的连接???
查了下文档和源码,没发现;
尝试使用disconnect也无效

我将自定义的Loader对象一个信号,连接到QCoreAppliaction::quit()槽,确实能让程序退出。

离线dbzhang800

只看该作者 1楼 发表于: 2013-08-15
看QApplication Manual:

setQuitOnLastWindowClosed(bool quit)
离线陈小草
只看该作者 2楼 发表于: 2013-08-15
回 1楼(dbzhang800) 的帖子
This property holds whether the application implicitly quits when the last window is closed.

The default is true.

If this property is true, the applications quits 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 for sub-windows. Refer to Qt::WindowType for a detailed list of Qt::Window objects.

有效
很感谢!
快速回复
限100 字节
 
上一个 下一个