snake build on v8 success
This commit is contained in:
@@ -2,12 +2,13 @@
|
||||
|
||||
#include "DoricSuperNode.h"
|
||||
|
||||
void DoricSuperNode::blend(QQuickItem *view, QString name, QJSValue prop) {
|
||||
void DoricSuperNode::blend(QQuickItem *view, QString name, QJsonValue prop) {
|
||||
if (name == "subviews") {
|
||||
if (prop.isArray()) {
|
||||
const int length = prop.property("length").toInt();
|
||||
QJsonArray array = prop.toArray();
|
||||
const int length = array.size();
|
||||
for (int i = 0; i < length; ++i) {
|
||||
QJSValue subNode = prop.property(i);
|
||||
QJsonValue subNode = array.at(i);
|
||||
mixinSubNode(subNode);
|
||||
blendSubNode(subNode);
|
||||
}
|
||||
@@ -17,8 +18,8 @@ void DoricSuperNode::blend(QQuickItem *view, QString name, QJSValue prop) {
|
||||
}
|
||||
}
|
||||
|
||||
void DoricSuperNode::mixinSubNode(QJSValue subNode) {
|
||||
QString id = subNode.property("id").toString();
|
||||
void DoricSuperNode::mixinSubNode(QJsonValue subNode) {
|
||||
QString id = subNode["id"].toString();
|
||||
QList<QString> keys = subNodes.keys();
|
||||
if (!keys.contains(id)) {
|
||||
subNodes.insert(id, subNode);
|
||||
@@ -27,30 +28,36 @@ void DoricSuperNode::mixinSubNode(QJSValue subNode) {
|
||||
}
|
||||
}
|
||||
|
||||
void DoricSuperNode::mixin(QJSValue src, QJSValue target) {
|
||||
QJSValue srcProps = src.property("props");
|
||||
QJSValue targetProps = target.property("props");
|
||||
QJSValueIterator it(srcProps);
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
void DoricSuperNode::mixin(QJsonValue src, QJsonValue target) {
|
||||
QJsonValue srcProps = src["props"];
|
||||
QJsonValue targetProps = target["props"];
|
||||
|
||||
if (it.name() == "subviews" && it.value().isArray()) {
|
||||
foreach (const QString &key, srcProps.toObject().keys()) {
|
||||
QJsonValue value = srcProps[key];
|
||||
if (key == "subviews" && value.isArray()) {
|
||||
|
||||
} else {
|
||||
targetProps.setProperty(it.name(), it.value());
|
||||
targetProps.toObject().insert(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QJSValue DoricSuperNode::getSubModel(QString id) {
|
||||
QJsonValue DoricSuperNode::getSubModel(QString id) {
|
||||
if (subNodes.keys().contains(id)) {
|
||||
return subNodes.value(id);
|
||||
} else {
|
||||
return QJSValue::UndefinedValue;
|
||||
return QJsonValue::Undefined;
|
||||
}
|
||||
}
|
||||
|
||||
void DoricSuperNode::blendSubLayoutConfig(DoricViewNode *viewNode,
|
||||
QJSValue jsValue) {
|
||||
QJsonValue jsValue) {
|
||||
viewNode->blendLayoutConfig(jsValue);
|
||||
}
|
||||
|
||||
QJsonValue DoricSuperNode::generateDefaultLayoutConfig() {
|
||||
QJsonObject layoutConfig;
|
||||
layoutConfig.insert("widthSpec", 0);
|
||||
layoutConfig.insert("heightSpec", 0);
|
||||
return layoutConfig;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user