I got a signal in QML and I want to connect to a slot defined in C++. However my code is failing and I'm receiving the error:
QObject::connect: No such signal QDeclarativeContext::sent() in ../qt_cpp/mainwindow.cpp:66
Here is a c++ code snippet:
message_reading test;
QDeclarativeView tempview;
tempview.setSource(QUrl("qrc:/qml/media_screen.qml"));
QObject *item = tempview.rootContext();
QObject::connect(item, SIGNAL(sent()),
&test, SLOT(readMediaJSONDatabase(QString&)));
And here is a QML code snippet:
Image {
id: bluetooth
source: "images_mediahub/footer_icons/bluetooth_normal.png"
signal sent(string msg)
MouseArea {
anchors.fill: parent
onClicked: {
bluetooth.sent(Test.medialibrarydb.toString())
info_load.source="./bluetooth.qml"
}
}
}