add head & tail for h & v layout for fill
This commit is contained in:
@@ -25,10 +25,10 @@ void DoricGroupNode::blend(QJsonValue jsValue) {
|
||||
|
||||
void DoricGroupNode::configChildNode() {
|
||||
QQuickItem *parent = nullptr;
|
||||
if (mType.isEmpty() || mType == "Stack") {
|
||||
parent = mView;
|
||||
} else {
|
||||
if (mType == "HLayout" || mType == "VLayout") {
|
||||
parent = mView->childItems().at(1);
|
||||
} else {
|
||||
parent = mView;
|
||||
}
|
||||
for (int idx = 0; idx < mChildViewIds.size(); idx++) {
|
||||
QString id = mChildViewIds.at(idx);
|
||||
@@ -140,6 +140,23 @@ void DoricGroupNode::configChildNode() {
|
||||
viewNode->getNodeView()->setParentItem(nullptr);
|
||||
viewNode->getNodeView()->deleteLater();
|
||||
}
|
||||
|
||||
// handle tail
|
||||
if (mType == "VLayout" || mType == "HLayout") {
|
||||
int tailIndex = -1;
|
||||
for (int idx = 0; idx < parent->childItems().size(); idx++) {
|
||||
if (parent->childItems().at(idx)->objectName() == "tail") {
|
||||
tailIndex = idx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (tailIndex != -1 && tailIndex != parent->childItems().size() - 1) {
|
||||
QQuickItem *tail = parent->childItems().at(tailIndex);
|
||||
tail->setParentItem(nullptr);
|
||||
tail->setParentItem(parent);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void DoricGroupNode::blendSubNode(QJsonValue subProperties) {
|
||||
|
||||
@@ -16,10 +16,11 @@ QQuickItem *DoricHLayoutNode::build() {
|
||||
}
|
||||
|
||||
void DoricHLayoutNode::blend(QQuickItem *view, QString name, QJsonValue prop) {
|
||||
QQuickItem *container = view->childItems().at(1);
|
||||
if (name == "space") {
|
||||
view->childItems().at(1)->setProperty("spacing", prop.toInt());
|
||||
container->setProperty("spacing", prop.toInt());
|
||||
} else if (name == "gravity") {
|
||||
view->childItems().at(1)->setProperty("gravity", prop.toInt());
|
||||
container->setProperty("gravity", prop.toInt());
|
||||
} else {
|
||||
DoricGroupNode::blend(view, name, prop);
|
||||
}
|
||||
|
||||
@@ -16,10 +16,11 @@ QQuickItem *DoricVLayoutNode::build() {
|
||||
}
|
||||
|
||||
void DoricVLayoutNode::blend(QQuickItem *view, QString name, QJsonValue prop) {
|
||||
QQuickItem *container = view->childItems().at(1);
|
||||
if (name == "space") {
|
||||
view->childItems().at(1)->setProperty("spacing", prop.toInt());
|
||||
container->setProperty("spacing", prop.toInt());
|
||||
} else if (name == "gravity") {
|
||||
view->childItems().at(1)->setProperty("gravity", prop.toInt());
|
||||
container->setProperty("gravity", prop.toInt());
|
||||
} else {
|
||||
DoricGroupNode::blend(view, name, prop);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user