Qt c++槽连接qml信号

QQmlEngine eengine; 
QQmlComponent component(&eengine, QUrl(QStringLiteral("qrc:/main.qml")));  
    QObject *object = component.create();  
File file(object);
QObject::connect(object, SIGNAL(signalButton()), &file, SLOT(ListCode()));


/*  main.qml文件
Window {
    id: window
    objectName: "windows"
    visible: true
    width: 1270
    height: 720
    title: qsTr("Hello World")
    color: "#f9f9d8"
    signal signalButton() //信号声明
*/

 

posted @ 2022-02-10 13:58  chyn  阅读(100)  评论(0)    收藏  举报