add title & ok label

This commit is contained in:
王劲鹏 2021-04-22 11:48:22 +08:00 committed by osborn
parent 70cf4acd5b
commit dda16db50a
2 changed files with 14 additions and 2 deletions

View File

@ -94,6 +94,9 @@ void DoricModalPlugin::alert(QString jsValueString, QString callbackId) {
window->setProperty("plugin", QString::number((qint64)this)); window->setProperty("plugin", QString::number((qint64)this));
window->setProperty("callbackId", callbackId); window->setProperty("callbackId", callbackId);
window->setProperty("title", titleVal.toString());
window->setProperty("okLabel", okBtn.toString());
QQuickWindow *parentWindow = QQuickWindow *parentWindow =
getContext()->getRootNode()->getRootView()->window(); getContext()->getRootNode()->getRootView()->window();

View File

@ -12,9 +12,19 @@ Window {
property var plugin property var plugin
property var callbackId property var callbackId
property var title
property var okLabel
onTitleChanged: {
dialog.title = title
}
onOkLabelChanged: {
dialog.standardButton(Dialog.Ok).text = qsTrId(okLabel)
}
Dialog { Dialog {
id: dialog id: dialog
title: "Title"
standardButtons: Dialog.Ok standardButtons: Dialog.Ok
modal: true modal: true
@ -33,6 +43,5 @@ Window {
Component.onCompleted: { Component.onCompleted: {
dialog.open() dialog.open()
dialog.standardButton(Dialog.Ok).text = qsTrId("OkLabel")
} }
} }