Connecting QML signals with Qt slots.
-
Hi! I have such code:
@Item {
signal itemClicked()MouseArea {
anchor.fill: parent
onClicked: itemClicked()
}
}@Can I connect itemClicked() to slot in cpp application?
@QDeclarativeEngine *engine = new QDeclarativeEngine;
QDeclarativeComponent component(engine, QUrl::fromLocalFile("qml/TestQML/TestQML.qml"));
QObject *myObject = component.create();
QDeclarativeItem item = qobject_cast<QDeclarativeItem>(myObject);
qDebug()<<QObject::connect(item, SIGNAL(titleBarClicked()), &viewer, SLOT(showMaximized()));@connect() retuns true, but it doesn't work.
-
-
Hi,
Could you add a bug report on "http://bugreports.qt.nokia.com":bugreports.qt.nokia.com with a small example to reproduce the problem?
Thanks,
Michael -
I've tried this feature in a simple project and it works. So the mistake somewhere in the my test app.
P.S. You can see this "code example":http://www.fileconvoy.com/filelist.php?id=gfd6e298a19c42fa5359453643e0534cdae6ef.
Maybe you are know what's wrong :)