在下面的C++代码中,我加载了一个qml文件。但是C++插槽不起作用。没有出现错误或警告,但调试消息始终为“a”字符。没有出现“b”字符。你能告诉我为什么吗?谢谢。
C++侧代码
C++侧代码
::::::::::::::
view=new QDeclarativeView;
view->setSource(QUrl("qml/groundMenu/Ground.qml"));
rootObject = dynamic_cast<QObject*>(view->rootObject());
QObject::connect(rootObject, SIGNAL(qmlSignal()),this, SLOT(qmlLoadedProcess()));
:::::::::::::::::
void MainWindow::qmlLoadedProcess()
{
qDebug()<<"b";
}
//qml side code
Rectangle
{
signal qmlSignal()
Component.onCompleted:
{
qmlSignal()
console.log("a")
}
}