QML和qt直接信号的传递方法

viewer_small = new QDeclarativeView;
viewer_small->engine()->setBaseUrl(QUrl::fromLocalFile(getAppDirectory()));
viewer_small->setSource(QUrl::fromLocalFile(“Smallfloat.qml”));
// viewer_float->setSource(QUrl(“…/qml/floatmain.qml”));
viewer_small->setResizeMode(QDeclarativeView::SizeRootObjectToView);
QObject srootObject = dynamic_cast<QObject>(viewer_small->rootObject());
QObject::connect(srootObject, SIGNAL(send_signal_to_large()), handler, SLOT(signalHandler()));
QObject::connect(tray, SIGNAL(showFloat()), srootObject, SLOT(show_float_frame()));
viewer_small->rootContext()->setContextProperty(“smallwindow”, viewer_small);
viewer_small->setStyleSheet(“background:transparent”);
viewer_small->setAttribute(Qt::WA_TranslucentBackground);
viewer_small->setWindowFlags(Qt::FramelessWindowHint);
QDesktopWidget* sdesktop = QApplication::desktop();
viewer_small->move(sdesktop->width(), 0);
viewer_small->show();