I want to ask simple question for quick solution. I have ListView
and Button
in main.qml and Component
in closingtaskdelage.qml. Here is file main.qml:
ListView
{
id: grid
delegate:mydelegate
model: mymodel
spacing: 5
orientation:ListView.Vertical
Layout.preferredWidth: width_commmon
Layout.preferredHeight: height_body
Layout.maximumHeight: 800
Layout.alignment: Qt.AlignHCenter
// highlightFollowsCurrentItem: false
focus: true
ClosingTaskModel
{
id:mymodel
}
ClosingTaskDelegate
{
id:mydelegate
}
}
Button
{
id:finishbutton
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: width_commmon
Layout.preferredHeight:height_endbutton
text: "İş Emrini Tamamla"
onClicked:
{
// console.log((grid.children["border1"]).id);
}
}
and file ClosingTaskDelegate.qml:
Component
{
id:component1
Rectangle
{
signal sendMenuValuestoJS
height: 200
width: 200
Text
{
id:text1;
text:header;
height:parent.height/2
// width: parent.width
anchors.horizontalCenter:parent.horizontalCenter;
font.pointSize:20;
color:"red";
// height:parent.height/2
// width: parent.width
}
}
}
Don't care about details. My main problem is: When onClickButton()
in main.qml occurs, signal sendMenuValuestoJS()
must be triggered. This signal must send string value as parameter (i.e. send Text).
I can't access signal from main.qml. I have defined signal in the Component
, but I get following runtime QML error:
Component objects cannot declare new signals.
How do I connect signal to some function?