[solved]how to use "buttonClicked" in Qt Quick Symbian Component, CommonDialog
-
In Qt Quick Symbian Component, QML CommonDialog Element, it says
Signal Handler DocumentationCommonDialog::buttonClicked ( int index )
This signal is emitted when one of the buttons is clicked. The index parameter holds the index of the clicked button. The index is the same as the index of the button text in the buttonTexts property.
"doc.qt.nokia.com/qtquick-components-symbian-1.1/qml-commondialog.html":http://doc.qt.nokia.com/qtquick-components-symbian-1.1/qml-commondialog.htmlHowever, I do not know how to use it. In my code
@CommonDialog {
id: interruptDialog
buttonTexts:["Interrupt"]
titleText: "Notice"
titleIcon: "alarm.svg"
content: Column {
anchors.horizontalCenter: parent.horizontalCenter
spacing: 4
Text {
id: textInterruptDialog
anchors.horizontalCenter: parent.horizontalCenter
color: "deepskyblue"
}
Text {
anchors.horizontalCenter: parent.horizontalCenter
color: "deepskyblue"
font.family: platformStyle.fontFamilyRegular
font.pointSize: 14
text: alarmClockTimer.countDownClockString
}
}
buttonClicked: { interruptDialogButtonClicked() } //doesn't work
buttonClicked(0): { interruptDialogButtonClicked() } //doesn't work too
}@Anyone can help?
Thank you.
-
I sovle this myselft. It shoulb be
@onButtonClick: { interruptDialogButtonClicked() }@I think I should file a bug on this?
-
I know more about this, hope someone will benefit from this.
@CommonDialog {
id: pomotimeSettingCommonDialog
buttonTexts : [qsTr("OK"), qsTr("Cancel")]
titleIcon : "time.svg"
titleText : qsTr("test dialog")
content: Column {
Text {
color:"white"
text: "This is a test dialog"
}
}
onButtonClicked: {
//CommonDialog::buttonClicked ( int index ) means index is a viariable you can use
if(!index) { //OK button is for index = 0, so !index means true
console.log("you press the OK button")
}
else {
console.log("you press the Cancel button")
}
}
}@ -
Great job.I definitely benefited from your last post code exam ple
-
Glad it helps you. lol