diff --git a/doric-Qt/doric/doric.pro b/doric-Qt/doric/doric.pro index 7eb7d0db..470be94a 100644 --- a/doric-Qt/doric/doric.pro +++ b/doric-Qt/doric/doric.pro @@ -1,6 +1,6 @@ QT += quick -CONFIG += c++11 +CONFIG += c++14 # The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings diff --git a/doric-Qt/doric/engine/native/NativeExecutor.cpp b/doric-Qt/doric/engine/native/NativeExecutor.cpp index aa345322..6e6cbf4e 100644 --- a/doric-Qt/doric/engine/native/NativeExecutor.cpp +++ b/doric-Qt/doric/engine/native/NativeExecutor.cpp @@ -1,5 +1,7 @@ #include "NativeExecutor.h" +#include + NativeExecutor::NativeExecutor() { mJSEngine = new QJSEngine(); mJSEngine->installExtensions(QJSEngine::AllExtensions); diff --git a/doric-Qt/doric/plugin/DoricModalPlugin.cpp b/doric-Qt/doric/plugin/DoricModalPlugin.cpp index 84a26373..3afb0e3c 100644 --- a/doric-Qt/doric/plugin/DoricModalPlugin.cpp +++ b/doric-Qt/doric/plugin/DoricModalPlugin.cpp @@ -35,14 +35,16 @@ void DoricModalPlugin::toast(QString jsValueString, QString callbackId) { .at(0) ->childItems() .at(0) + ->childItems() + .at(0) ->setProperty("text", msg); - std::function setX = [window, parentWindow]() { + std::function setX = [window, parentWindow]() { window->setProperty("x", (parentWindow->width() - window->width()) / 2.f + parentWindow->x()); }; - std::function setY = [window, parentWindow, gravity]() { + std::function setY = [window, parentWindow, gravity]() { if ((gravity & DoricGravity::DoricGravityBottom) == DoricGravity::DoricGravityBottom) { window->setProperty("y", parentWindow->height() - window->height() - @@ -101,12 +103,12 @@ void DoricModalPlugin::alert(QString jsValueString, QString callbackId) { QQuickWindow *parentWindow = getContext()->getRootNode()->getRootView()->window(); - std::function setX = [window, parentWindow]() { + std::function setX = [window, parentWindow]() { window->setProperty("x", (parentWindow->width() - window->width()) / 2.f + parentWindow->x()); }; - std::function setY = [window, parentWindow]() { + std::function setY = [window, parentWindow]() { window->setProperty("y", (parentWindow->height() - window->height()) / 2 + parentWindow->y()); @@ -156,12 +158,12 @@ void DoricModalPlugin::confirm(QString jsValueString, QString callbackId) { QQuickWindow *parentWindow = getContext()->getRootNode()->getRootView()->window(); - std::function setX = [window, parentWindow]() { + std::function setX = [window, parentWindow]() { window->setProperty("x", (parentWindow->width() - window->width()) / 2.f + parentWindow->x()); }; - std::function setY = [window, parentWindow]() { + std::function setY = [window, parentWindow]() { window->setProperty("y", (parentWindow->height() - window->height()) / 2 + parentWindow->y()); @@ -211,12 +213,12 @@ void DoricModalPlugin::prompt(QString jsValueString, QString callbackId) { QQuickWindow *parentWindow = getContext()->getRootNode()->getRootView()->window(); - std::function setX = [window, parentWindow]() { + std::function setX = [window, parentWindow]() { window->setProperty("x", (parentWindow->width() - window->width()) / 2.f + parentWindow->x()); }; - std::function setY = [window, parentWindow]() { + std::function setY = [window, parentWindow]() { window->setProperty("y", (parentWindow->height() - window->height()) / 2 + parentWindow->y()); diff --git a/doric-Qt/doric/resources/alert.qml b/doric-Qt/doric/resources/alert.qml index f48e8c54..f6431859 100644 --- a/doric-Qt/doric/resources/alert.qml +++ b/doric-Qt/doric/resources/alert.qml @@ -1,7 +1,7 @@ import QtQuick 2.12 import QtQuick.Controls 2.12 -Window { +ApplicationWindow { id: window flags: flags | Qt.WindowStaysOnTopHint | Qt.Tool | Qt.FramelessWindowHint diff --git a/doric-Qt/doric/resources/confirm.qml b/doric-Qt/doric/resources/confirm.qml index 997f1ba3..d5e26a0d 100644 --- a/doric-Qt/doric/resources/confirm.qml +++ b/doric-Qt/doric/resources/confirm.qml @@ -1,7 +1,7 @@ import QtQuick 2.12 import QtQuick.Controls 2.12 -Window { +ApplicationWindow { id: window flags: flags | Qt.WindowStaysOnTopHint | Qt.Tool | Qt.FramelessWindowHint diff --git a/doric-Qt/doric/resources/prompt.qml b/doric-Qt/doric/resources/prompt.qml index 95adcc29..893e39d7 100644 --- a/doric-Qt/doric/resources/prompt.qml +++ b/doric-Qt/doric/resources/prompt.qml @@ -2,7 +2,7 @@ import QtQuick 2.12 import QtQuick.Controls 2.12 import QtQuick.Layouts 1.15 -Window { +ApplicationWindow { id: window flags: flags | Qt.WindowStaysOnTopHint | Qt.Tool | Qt.FramelessWindowHint diff --git a/doric-Qt/doric/resources/toast.qml b/doric-Qt/doric/resources/toast.qml index 4e9075b4..1e49837e 100644 --- a/doric-Qt/doric/resources/toast.qml +++ b/doric-Qt/doric/resources/toast.qml @@ -2,7 +2,7 @@ import QtQuick 2.12 import QtQuick.Controls 2.5 import QtQuick.Layouts 1.15 -Window { +ApplicationWindow { id: window flags: flags | Qt.WindowStaysOnTopHint | Qt.Tool | Qt.FramelessWindowHint | Qt.WindowTransparentForInput diff --git a/doric-Qt/doric/shader/DoricGroupNode.cpp b/doric-Qt/doric/shader/DoricGroupNode.cpp index 16504e25..0a9849a5 100644 --- a/doric-Qt/doric/shader/DoricGroupNode.cpp +++ b/doric-Qt/doric/shader/DoricGroupNode.cpp @@ -48,7 +48,7 @@ void DoricGroupNode::configChildNode() { oldNode->blend(model["props"]); } else { // Replace this view - mChildNodes.remove(idx); + mChildNodes.removeAt(idx); oldNode->getNodeView()->setParent(nullptr); oldNode->getNodeView()->setParentItem(nullptr); oldNode->getNodeView()->deleteLater(); @@ -132,7 +132,7 @@ void DoricGroupNode::configChildNode() { int size = mChildNodes.size(); for (int idx = mChildViewIds.size(); idx < size; idx++) { DoricViewNode *viewNode = mChildNodes.at(mChildViewIds.size()); - mChildNodes.remove(mChildViewIds.size()); + mChildNodes.removeAt(mChildViewIds.size()); viewNode->getNodeView()->setParent(nullptr); viewNode->getNodeView()->setParentItem(nullptr); viewNode->getNodeView()->deleteLater(); diff --git a/doric-Qt/doric/shader/DoricViewNode.cpp b/doric-Qt/doric/shader/DoricViewNode.cpp index 07b68b2a..c70dc8b9 100644 --- a/doric-Qt/doric/shader/DoricViewNode.cpp +++ b/doric-Qt/doric/shader/DoricViewNode.cpp @@ -153,7 +153,7 @@ void DoricViewNode::requestLayout() {} void DoricViewNode::callJSResponse(QString funcId, QVariantList args) { QVariantList nArgs; QList idList = getIdList(); - nArgs.append(idList); + nArgs.append(QVariant(idList)); nArgs.append(funcId); foreach (const QVariant &arg, args) nArgs.append(arg); diff --git a/doric-Qt/doric/utils/DoricLayouts.cpp b/doric-Qt/doric/utils/DoricLayouts.cpp index bbf3c893..3e92d468 100644 --- a/doric-Qt/doric/utils/DoricLayouts.cpp +++ b/doric-Qt/doric/utils/DoricLayouts.cpp @@ -492,9 +492,9 @@ void DoricLayouts::setFrame() { << " measuredX: " << this->measuredX << " measuredY: " << this->measuredY; - if (qFabs(this->measuredWidth - this->view->width() >= 0.00001f)) + if (qAbs(this->measuredWidth - this->view->width() >= 0.00001f)) this->view->setProperty("width", this->measuredWidth); - if (qFabs(this->measuredHeight - this->view->height() >= 0.00001f)) + if (qAbs(this->measuredHeight - this->view->height() >= 0.00001f)) this->view->setProperty("height", this->measuredHeight); this->view->setProperty("x", this->measuredX); diff --git a/doric-Qt/doric/utils/DoricUtils.h b/doric-Qt/doric/utils/DoricUtils.h index c23f0a38..83bb1c56 100644 --- a/doric-Qt/doric/utils/DoricUtils.h +++ b/doric-Qt/doric/utils/DoricUtils.h @@ -14,7 +14,7 @@ public: QFile *file = new QFile(resource.fileName()); file->open(QFile::ReadOnly | QFile::Text); QTextStream in(file); - in.setEncoding(QStringConverter::Encoding::Utf8); + in.setAutoDetectUnicode(true); QString content = in.readAll(); file->close(); delete file;