[solved]how to use "buttonClicked" in Qt Quick Symbian Component, CommonDialog
-
wrote on 11 Feb 2012, 10:24 last edited by
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.
-
wrote on 11 Feb 2012, 12:22 last edited by
I sovle this myselft. It shoulb be
@onButtonClick: { interruptDialogButtonClicked() }@I think I should file a bug on this?
-
wrote on 21 Apr 2012, 03:26 last edited by
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")
}
}
}@ -
wrote on 2 Dec 2013, 13:52 last edited by
Great job.I definitely benefited from your last post code exam ple
-
wrote on 2 Dec 2013, 14:03 last edited by
Glad it helps you. lol