AbinaThomas
7th September 2012, 07:35
Hi,
I loaded a QML file from QT C++ class using QDeclarativeView object. I want a signal from QML file to CPP after it is active.
My sample code is :
QDeclarativeView *view = new QDeclarativeView();
view->setSource(QUrl::fromLocalFile("base.qml"));
Qmlview = view;
QObject *item = view->rootObject();
QObject::connect(item,SIGNAL(qmlSignal(QString)),t his,SLOT(cppSlot(QString)));
Qmlview->show();
and in the QML side i wrote:
Rectangle {
id : item1
width: 400
height: 400
color: "#d5b9b9"
signal qmlSignal(string msg)
Component.onCompleted:
{
item1.qmlSignal("string msg")
}
}
but it seems that the signal will emit before the connection handler.
Is there any event in QML which will active after "Qmlview->show();" ?
Thanks in advance...
I loaded a QML file from QT C++ class using QDeclarativeView object. I want a signal from QML file to CPP after it is active.
My sample code is :
QDeclarativeView *view = new QDeclarativeView();
view->setSource(QUrl::fromLocalFile("base.qml"));
Qmlview = view;
QObject *item = view->rootObject();
QObject::connect(item,SIGNAL(qmlSignal(QString)),t his,SLOT(cppSlot(QString)));
Qmlview->show();
and in the QML side i wrote:
Rectangle {
id : item1
width: 400
height: 400
color: "#d5b9b9"
signal qmlSignal(string msg)
Component.onCompleted:
{
item1.qmlSignal("string msg")
}
}
but it seems that the signal will emit before the connection handler.
Is there any event in QML which will active after "Qmlview->show();" ?
Thanks in advance...