1.预加载:
static void preRoutineMyDebugTool()
{
qDebug()<<"prepare...........";
}
Q_COREAPP_STARTUP_FUNCTION(preRoutineMyDebugTool)
运行效果:
2.程序结束后清理:
static void cleanup_ptr()
{
qDebug()<<"clear.............";
}
int main(int argc, char *argv[])
{
SingleApplication app(argc, argv, true);
qAddPostRoutine(cleanup_ptr); // delete later
.........................
return app.exe();
}
运行结果: