The CommonDialog is a handy part of the Symbian Qt Quick Set, you can use it for pretty much anything within reason.
Here is a basic example of one with more than one button, this closes the app, and the second button just writes on the Console.
The Title is defined like this:
titleText: "Exit"
Private Close Icon (the little close icon in the top corner)
privateCloseIcon: true
The Buttons text:
buttonTexts: ["Yes", qsTr("Log on console")]
The Dialogs content, in this case some simple text:
content: Label { anchors.centerIn: parent; text: "Are you sure you want to leave?";}
Finally the commands for the buttons themselves, the first button as if (index === 0) Qt.quit();
The second button as else if (index === 1) Console.log ("Button Two Pressed")
For a third and more you would carry on changing the (index === 1)
to (index === 2)
and carry on changing the number up for each one.
onButtonClicked: {
if (index === 0) Qt.quit();
else if (index === 1) Console.log ("Button Two Pressed")
}
CommonDialog {
id: closeDialog
titleText: "Exit"
privateCloseIcon: true
buttonTexts: ["Yes", qsTr("Log on console")]
content: Label { anchors.centerIn: parent; text: "Are you sure you want to leave?";}
onButtonClicked: {
if (index === 0) Qt.quit();
else if (index === 1) Console.log ("Button Two Pressed")
}
}