Hello all !
I am trying to emit a signal from Qt to QML file.
I tried to implement it as shown below.
But the slot_test in qml is not being called.
Kindly help to fix it.
void ProcessInfo::init()
{
emit emit_test();
}
int main(int argc, char *argv[])
{
QQmlApplicationEngine engine(QUrl("main.qml"));
QObject *topLevel = engine.rootObjects().value(0);
QObject::connect(&settings, SIGNAL(emit_test()), topLevel, SLOT(slot_test()));
QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
if ( !window ) {
qWarning("Error: Your root item has to be a Window.");
return -1;
}
window->show();
return app.exec();
}
Thanks & Regards,
Narayanan K
↧