其他分享
首页 > 其他分享> > Signal QQmlEngine::quit() emitted, but no receivers connected to handle it quit

Signal QQmlEngine::quit() emitted, but no receivers connected to handle it quit

作者:互联网

1、问题描述

在QML中调用Qt.quit()但是程序没有退出

Keys.onPressed:
{
    switch(event.key)
    {
     case Qt.Key_M:
             Qt.quit();
             break;
    }
}

 

2、解决

//main.cpp
QApplication    app(argc, argv);
QQuickView      viewer;
QObject::connect(viewer.engine(), SIGNAL(quit()), &app, SLOT(quit()));

 

标签:quit,handle,Qt,no,viewer,app,QQuickView,connect
来源: https://www.cnblogs.com/judes/p/15801768.html