Hi , did you see the example code at http://qt-project.org/doc/qt-5/qml-qtquick-dialogs-messagedialog.html#details ?
What did you try and why doesn’t it work for you? The example looks fairly easy to implement I guess.
You just need to modify the code a little if you want to open it from a JS function, do it like
import QtQuick 2.2
import QtQuick.Dialogs 1.1
MessageDialog {
id: messageDialog
title: "May I have your attention please"
text: "It's so cool that you are using Qt Quick."
onAccepted: {
// whatever you wanna do
}
}
// in your JS function
messageDialog.open()
if you want you can of course create the MessageDialog dynamically, but this is the easy way :)
If you need to create it dynamically you can use a Loader or Component in QML.
↧