Qt中QMainWindow右上角的红叉是响应的哪个函数?

bluegem218 2014-05-02 11:13:58
Qt中QMainWindow右上角的红叉是响应的哪个函数?
我发现点击窗口右上角的红色叉叉后,不是响应的close(),应该响应的MFC中Destroy()之类的函数,而且进入~CMyWindow()析构函数之前调用这个函数。
怎么找出来呢?
...全文
1288 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
bluegem218 2014-05-05
  • 打赏
  • 举报
回复
感谢两位。 其实我当天就解决了。 还是给两位分。 希望越来越多的人用Qt。 只有用的人多了,Qt才会越来越好用。
dbzhang800 2014-05-03
  • 打赏
  • 举报
回复
void QWidget::closeEvent(QCloseEvent * event) [virtual protected]
percepto 2014-05-03
  • 打赏
  • 举报
回复
void QWidget::closeEvent(QCloseEvent * event) [virtual protected] This event handler is called with the given event when Qt receives a window close request for a top-level widget from the window system. By default, the event is accepted and the widget is closed. You can reimplement this function to change the way the widget responds to window close requests. For example, you can prevent the window from closing by calling ignore() on all events. Main window applications typically use reimplementations of this function to check whether the user's work has been saved and ask for permission before closing. For example, the Application Example uses a helper function to determine whether or not to close the window:
void MainWindow::closeEvent(QCloseEvent *event)
{
    if (maybeSave()) {
        writeSettings();
        event->accept();
    } else {
        event->ignore();
    }
}

16,201

社区成员

发帖
与我相关
我的任务
社区描述
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
  • Qt
  • 亭台六七座
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧