From b49140201dfe167d17ca66b451726e62344dcc4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8A=B2=E9=B9=8F?= Date: Thu, 6 May 2021 10:02:29 +0800 Subject: [PATCH] give a default value when ok & cancel label empty --- doric-Qt/example/doric/plugin/DoricModalPlugin.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/doric-Qt/example/doric/plugin/DoricModalPlugin.cpp b/doric-Qt/example/doric/plugin/DoricModalPlugin.cpp index 3afb0e3c..4bb64de8 100644 --- a/doric-Qt/example/doric/plugin/DoricModalPlugin.cpp +++ b/doric-Qt/example/doric/plugin/DoricModalPlugin.cpp @@ -207,8 +207,17 @@ void DoricModalPlugin::prompt(QString jsValueString, QString callbackId) { window->setProperty("title", titleVal.toString()); window->setProperty("msg", msgVal.toString()); - window->setProperty("okLabel", okBtn.toString()); - window->setProperty("cancelLabel", cancelBtn.toString()); + if (okBtn.isString()) { + window->setProperty("okLabel", okBtn.toString()); + } else { + window->setProperty("okLabel", "ok"); + } + + if (cancelBtn.isString()) { + window->setProperty("cancelLabel", cancelBtn.toString()); + } else { + window->setProperty("cancelLabel", "cancel"); + } QQuickWindow *parentWindow = getContext()->getRootNode()->getRootView()->window();