Here is an example of qml:
Item {
signal titleBarClicked()
MouseArea {
anchor.fill: parent
onClicked: titleBarClicked()
}
}
Item {
signal titleBarClicked()
MouseArea {
anchor.fill: parent
onClicked: titleBarClicked()
}
}
To copy to clipboard, switch view to plain text mode
and C++:
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()));
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()));
To copy to clipboard, switch view to plain text mode
connect() return true, but slot is not called. What's wrong?
P.S. If you want to vote for this bug - go there
Bookmarks