I am trying to connect a c++ signal to QML but i cannot figure out how to do this exactly.
i have read the following questions:
Warning when connecting c++ signal to qml slot
and a few others. But i am still missing something as i am getting the following error:
QObject::connect: Cannot connect DataGather::loginSequenceFinished() to (null)::testing123()
my main.cpp is:
int main(int argc, char *argv[])
{
   // QGuiApplication app(argc, argv);
    QApplication app(argc, argv);
    DataGather gather;
    //createData();
    TreeModel model("test");
    //QTreeView treeview;
    //treeview.setModel(&model);
    //treeview.show();
    QQuickView *view = new QQuickView;
    view->setResizeMode(QQuickView::SizeRootObjectToView);
    QQmlContext *ctxt = view->rootContext();
    qmlRegisterType<TreeModel>();
    qmlRegisterType<ListModel>();
    qmlRegisterType<DataGather>();
    ctxt->setContextProperty("treemodel", &model);
    ctxt->setContextProperty("gatherer", &gather);
    auto root = view->rootObject();
    auto myElement = root->findChild<QObject*>(QLatin1Literal("LoginButtonID"));
    QObject::connect(&gather, SIGNAL(loginSequenceFinished()), myElement, SLOT(testing123()));
    view->setSource(QUrl(QStringLiteral("qrc:/main.qml")));
    //view.setSource(QUrl(QStringLiteral("qrc:/FrontPage.qml")));
    view->show();
    return app.exec();
}
main.qml:
Rectangle {
        objectName: "LoginButtonID"
        id: loginRectID
        height: loginRectText.height
        width: loginRectText.width
        color: "black"
        clip: true
        anchors.bottom: parent.bottom
        anchors.bottomMargin: parent.height * 0.05
        anchors.right: passwordFieldID.right
        function testing123() { console.log("working!"); }
        Text {
            id: loginRectText
            font.family: "Segoe UI Light"
            font.pointSize: 30
            text: "Login"
            color: "red"
            anchors.right: parent.right
            anchors.top: parent.top
        }
        MouseArea {
            id: loginButtonMouseAreaID
            width: parent.width + 40
            height: parent.height + 40
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.verticalCenter: parent.verticalCenter
            onClicked: {
                gatherer.loginAndFetchID(usernameTextID.text, passwordTextID.text)
                console.log( usernameTextID.text + " " + passwordTextID.text )
            }
        }
    }
What i am trying to accomplish is:
When the Loginbutton is clicked, the function LoginAndFetchID is run which takes care of the whole login procedure. And when it finishes, i want to emit a signal to qml so that the next procedure can be started.. for example, showing a load screen if login information is correct.
So the question is: What am i missing with this connection thing? How do i fix this error?
i probably have to specify the full path to testing123 because it says: to (null)::testing123().
but i have no idea what the full path would be.
 
    