add x & y & spacing; render try catch; remove rectangle layer in qml

This commit is contained in:
王劲鹏 2021-02-24 15:47:57 +08:00 committed by osborn
parent 850d6321a0
commit d35c8d2118
7 changed files with 25 additions and 25 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.14.0, 2021-02-24T10:31:57. --> <!-- Written by QtCreator 4.14.0, 2021-02-24T14:48:39. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>

View File

@ -6,6 +6,7 @@
void DoricShaderPlugin::render(QJSValue jsValue, QString callbackId) { void DoricShaderPlugin::render(QJSValue jsValue, QString callbackId) {
getContext()->getDriver()->asyncCall( getContext()->getDriver()->asyncCall(
[this, jsValue] { [this, jsValue] {
try {
QString viewId = jsValue.property("id").toString(); QString viewId = jsValue.property("id").toString();
DoricRootNode *rootNode = getContext()->getRootNode(); DoricRootNode *rootNode = getContext()->getRootNode();
@ -19,6 +20,9 @@ void DoricShaderPlugin::render(QJSValue jsValue, QString callbackId) {
viewNode->blend(jsValue.property("props")); viewNode->blend(jsValue.property("props"));
} }
} }
} catch (...) {
qCritical() << "render exception";
}
}, },
DoricThreadMode::UI); DoricThreadMode::UI);
} }

View File

@ -1,9 +1,6 @@
import QtQuick 2.12 import QtQuick 2.12
import QtQuick.Controls 2.5 import QtQuick.Controls 2.5
Rectangle { Row {
Row {
}
} }

View File

@ -2,7 +2,4 @@ import QtQuick 2.12
import QtQuick.Controls 2.5 import QtQuick.Controls 2.5
Rectangle { Rectangle {
StackView {
}
} }

View File

@ -2,7 +2,4 @@ import QtQuick 2.12
import QtQuick.Controls 2.5 import QtQuick.Controls 2.5
Rectangle { Rectangle {
StackView {
}
} }

View File

@ -1,9 +1,6 @@
import QtQuick 2.12 import QtQuick 2.12
import QtQuick.Controls 2.5 import QtQuick.Controls 2.5
Rectangle { Column {
Column {
}
} }

View File

@ -47,5 +47,13 @@ void DoricViewNode::blend(QQuickItem *view, QString name, QJSValue prop) {
} else if (name == "backgroundColor") { } else if (name == "backgroundColor") {
QString color = DoricUtils::doricColor(prop.toNumber()).name(); QString color = DoricUtils::doricColor(prop.toNumber()).name();
view->setProperty("color", color); view->setProperty("color", color);
} else if (name == "x") {
view->setProperty("x", prop.toInt());
} else if (name == "y") {
view->setProperty("y", prop.toInt());
} else if (name == "space") {
view->setProperty("spacing", prop.toInt());
} else {
qCritical() << name << ": " << prop.toString();
} }
} }