add x & y & spacing; render try catch; remove rectangle layer in qml
This commit is contained in:
parent
850d6321a0
commit
d35c8d2118
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!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>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
@ -6,18 +6,22 @@
|
||||
void DoricShaderPlugin::render(QJSValue jsValue, QString callbackId) {
|
||||
getContext()->getDriver()->asyncCall(
|
||||
[this, jsValue] {
|
||||
QString viewId = jsValue.property("id").toString();
|
||||
DoricRootNode *rootNode = getContext()->getRootNode();
|
||||
try {
|
||||
QString viewId = jsValue.property("id").toString();
|
||||
DoricRootNode *rootNode = getContext()->getRootNode();
|
||||
|
||||
if (rootNode->getId().isEmpty() &&
|
||||
jsValue.property("type").toString() == "Root") {
|
||||
rootNode->setId(viewId);
|
||||
rootNode->blend(jsValue.property("props"));
|
||||
} else {
|
||||
DoricViewNode *viewNode = getContext()->targetViewNode(viewId);
|
||||
if (viewNode != nullptr) {
|
||||
viewNode->blend(jsValue.property("props"));
|
||||
if (rootNode->getId().isEmpty() &&
|
||||
jsValue.property("type").toString() == "Root") {
|
||||
rootNode->setId(viewId);
|
||||
rootNode->blend(jsValue.property("props"));
|
||||
} else {
|
||||
DoricViewNode *viewNode = getContext()->targetViewNode(viewId);
|
||||
if (viewNode != nullptr) {
|
||||
viewNode->blend(jsValue.property("props"));
|
||||
}
|
||||
}
|
||||
} catch (...) {
|
||||
qCritical() << "render exception";
|
||||
}
|
||||
},
|
||||
DoricThreadMode::UI);
|
||||
|
@ -1,9 +1,6 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.5
|
||||
|
||||
Rectangle {
|
||||
Row {
|
||||
|
||||
}
|
||||
Row {
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,4 @@ import QtQuick 2.12
|
||||
import QtQuick.Controls 2.5
|
||||
|
||||
Rectangle {
|
||||
StackView {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,4 @@ import QtQuick 2.12
|
||||
import QtQuick.Controls 2.5
|
||||
|
||||
Rectangle {
|
||||
StackView {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,6 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.5
|
||||
|
||||
Rectangle {
|
||||
Column {
|
||||
|
||||
}
|
||||
Column {
|
||||
}
|
||||
|
||||
|
@ -47,5 +47,13 @@ void DoricViewNode::blend(QQuickItem *view, QString name, QJSValue prop) {
|
||||
} else if (name == "backgroundColor") {
|
||||
QString color = DoricUtils::doricColor(prop.toNumber()).name();
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user