Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

writing function for onClicked signal of nested button

$
0
0
—Hi everyone, I am trying to build a message box that can be simply added and then apply a custom function to the onClicked function of each button. I have manage to create properties that can be passed through, but I was wondering if I can do this with signals in QML only? Main.qml   import "../MessageBox" as MessageBox   Rectangle{  width :300  height:300   MessageBox.YesNo{  captionText: "Are you sure you want to quit?"  ///buttonYes.onClicked...  ////buttonNo.onClicked... } Then here is YesNo.qml Rectangle{ width: parent.width height: 200   property string captionText: qsTr("")   RowLayout{  Button{   id: buttonYes   onClicked: parent.destroy()  }  Button{   id: buttonNo   onClicked: parent.destroy()  } } Thanks in advance

Viewing all articles
Browse latest Browse all 4972

Trending Articles