add msg text

This commit is contained in:
王劲鹏 2021-04-22 14:00:56 +08:00 committed by osborn
parent d47fa2bb7d
commit abccec1321
3 changed files with 18 additions and 0 deletions

View File

@ -95,6 +95,7 @@ void DoricModalPlugin::alert(QString jsValueString, QString callbackId) {
window->setProperty("callbackId", callbackId); window->setProperty("callbackId", callbackId);
window->setProperty("title", titleVal.toString()); window->setProperty("title", titleVal.toString());
window->setProperty("msg", msgVal.toString());
window->setProperty("okLabel", okBtn.toString()); window->setProperty("okLabel", okBtn.toString());
QQuickWindow *parentWindow = QQuickWindow *parentWindow =
@ -148,6 +149,7 @@ void DoricModalPlugin::confirm(QString jsValueString, QString callbackId) {
window->setProperty("callbackId", callbackId); window->setProperty("callbackId", callbackId);
window->setProperty("title", titleVal.toString()); window->setProperty("title", titleVal.toString());
window->setProperty("msg", msgVal.toString());
window->setProperty("okLabel", okBtn.toString()); window->setProperty("okLabel", okBtn.toString());
window->setProperty("cancelLabel", cancelBtn.toString()); window->setProperty("cancelLabel", cancelBtn.toString());

View File

@ -13,12 +13,17 @@ Window {
property var callbackId property var callbackId
property var title property var title
property var msg
property var okLabel property var okLabel
onTitleChanged: { onTitleChanged: {
dialog.title = title dialog.title = title
} }
onMsgChanged: {
content.text = msg
}
onOkLabelChanged: { onOkLabelChanged: {
dialog.standardButton(Dialog.Ok).text = qsTrId(okLabel) dialog.standardButton(Dialog.Ok).text = qsTrId(okLabel)
} }
@ -27,6 +32,9 @@ Window {
id: dialog id: dialog
standardButtons: Dialog.Ok standardButtons: Dialog.Ok
modal: true modal: true
contentItem: Text {
id: content
}
onAccepted: { onAccepted: {
dialogBridge.onAccepted(pointer, plugin, callbackId) dialogBridge.onAccepted(pointer, plugin, callbackId)

View File

@ -13,6 +13,7 @@ Window {
property var callbackId property var callbackId
property var title property var title
property var msg
property var okLabel property var okLabel
property var cancelLabel property var cancelLabel
@ -20,6 +21,10 @@ Window {
dialog.title = title dialog.title = title
} }
onMsgChanged: {
content.text = msg
}
onOkLabelChanged: { onOkLabelChanged: {
dialog.standardButton(Dialog.Ok).text = qsTrId(okLabel) dialog.standardButton(Dialog.Ok).text = qsTrId(okLabel)
} }
@ -32,6 +37,9 @@ Window {
id: dialog id: dialog
standardButtons: Dialog.Ok | Dialog.Cancel standardButtons: Dialog.Ok | Dialog.Cancel
modal: true modal: true
contentItem: Text {
id: content
}
onAccepted: { onAccepted: {
dialogBridge.onAccepted(pointer, plugin, callbackId) dialogBridge.onAccepted(pointer, plugin, callbackId)