c++ - QT关闭子窗口后如何执行函数

标签 c++ qt

我想在关闭子窗口后执行一个函数,这是我的代码,它没有按预期工作

Preferences *dialog = new Preferences();
connect(dialog,SIGNAL(destroyed()),this,SLOT(LoadSettings()));
dialog->show();

编辑:看来我错误地选择了 QmainWIndow 作为首选项对话框:-(,我可以在不将其移植到 Qdialog 的情况下解决这个问题吗?或者有什么简单的方法可以将 Qmainwindow ui 移植到 Qdialog ui

最佳答案

Preferences *dialog = new Preferences();
connect(dialog,SIGNAL(destroyed()),this,SLOT(LoadSettings()));
dialog->exec();
delete dialog;

关于c++ - QT关闭子窗口后如何执行函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21435089/

相关文章:

c++ - Qt4项目中引用mupdf

c++ - 为什么在 Visual Studio 2008/2010 中_不需要 typename?

c++ - Qt Installer Framework - 读取下载的包版本

qt - QNetworkAccessManager 文件上传错误

c++ - 运算符的模糊过载 "<<"

c++ - 使用模板重载方法

c++ - 如何使用 Turbo C++ 编译器配置 eclipse CDT

qt - 创建分支 QWizard 流

c++ - Qt - 如何在 QVBoxLayout 中放置具有左右边距的 QTextEdit?

c++ - 在 Windows 上使用 Qt5 进行奇怪的延迟绘画