Important: Please read the Qt Code of Conduct -

Passing signal from QML to C++ with parameter

  • Hi,
    I have an application where i want to pass signal from qml to c++.
    code in qml as

    signal blockUri(int uri)

    mainView.blockUri(index)// calling signal

    in c++ is as

    QObject *rootObject = mpView->rootObject();
    QObject::connect(rootObject, SIGNAL(blockUri(int)), this, SLOT(printData(int)));

    void someclass::printData(int uri)
    qDebug()<<"Text From QML:"<<uri;

    but text is not printing in C++ code.
    i know i am doing something wrong.
    So please any one can help me.

  • Can you write the exact connect command you using ?

Log in to reply