Q:

can't connect qml signal and c++ slot

I'm trying to connect a QML signal to C++ slot. but when I go forward using Qt guide, it occurs two errors:

file:///home/muhammad/Documents/qt_projects/build-Plaq-Desktop_Qt_5_8_0_GCC_64bit-Debug/qrc:/main.qml:
  No such file or directory
QObject::connect: Cannot connect (null)::qmlSignal(QString) to
  PlaqueFinder::cppSlot(QString)

and this is my code in main.cpp:
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <plaquefinder.h>
#include <QQuickView>
#include <QString>
#include <QObject>
int main(int argc, char *argv[])
{
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    QGuiApplication app(argc, argv);

    QQmlApplicationEngine engine;
    engine.load(QUrl(QLatin1String("qrc:/main.qml")));
    QQuickView view(QUrl::fromLocalFile("qrc:/main.qml"));
    QObject* item = (QObject*)view.rootObject();
    PlaqueFinder plaq;
    QObject::connect(item, SIGNAL(qmlSignal(QString)),
                         &plaq, SLOT(cppSlot(QString)));

    return app.exec();
}

how can I fix it?

A:

The example is unfortunately inaccurate
Try this:
int main(int argc, char *argv[])
{
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    QGuiApplication app(argc, argv);
    QQmlApplicationEngine engine;
    engine.load(QUrl(QLatin1String("qrc:/main.qml")));
    QObject* item = (QObject*)engine.rootObjects()[0];
    PlaqueFinder plaq;
    QObject::connect(item, SIGNAL(qmlSignal(QString)), &plaq, SLOT(cppSlot(QString)));
    return app.exec();
}

By this line you are creating your QQuickView and it is not neccesary to do it again by loading the same qml. 
engine.load(QUrl(QLatin1String("qrc:/main.qml")));

If you would like to connect some nestet object signal, then use findChild
to get proper item

