Item { id: topitem signal sendText(string text) ListView { model: StringList delegate: Rectangle { id: rectangle color: "yellow" MouseArea { z: -1 anchors.fill: parent; onPressed: { topitem.sendText( modelData ) rectangle.color = "lightyellow" } onReleased: {rectangle.color = "yellow"} } Text { id:itemName text: modelData } } }}
QObject* o = (QObject*) ui->listWidget->rootObject(); qWarning() << connect( o, SIGNAL(sendText(QString)), this, SLOT(see(QString)) );
void see(QString s){qWarning()<<s;}
objectName: "some name"
onPressed: { StringList.see("test") rectangle.color = "lightyellow" }