fix stack before warning
This commit is contained in:
parent
8ffc0753ef
commit
0f0b0b0756
@ -54,12 +54,16 @@ void DoricGroupNode::configChildNode() {
|
|||||||
newNode->setId(id);
|
newNode->setId(id);
|
||||||
newNode->init(this);
|
newNode->init(this);
|
||||||
newNode->blend(model.property("props"));
|
newNode->blend(model.property("props"));
|
||||||
mChildNodes.insert(idx, newNode);
|
|
||||||
|
|
||||||
int minIndex = qMin(idx, mView->childItems().size());
|
if (idx >= mChildNodes.size()) {
|
||||||
newNode->getNodeView()->setParentItem(mView);
|
mChildNodes.append(newNode);
|
||||||
newNode->getNodeView()->stackBefore(
|
newNode->getNodeView()->setParentItem(mView);
|
||||||
mView->childItems().at(minIndex));
|
} else {
|
||||||
|
mChildNodes.insert(idx, newNode);
|
||||||
|
newNode->getNodeView()->setParentItem(mView);
|
||||||
|
newNode->getNodeView()->stackBefore(
|
||||||
|
mView->childItems().at(idx));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -75,19 +79,8 @@ void DoricGroupNode::configChildNode() {
|
|||||||
}
|
}
|
||||||
if (position >= 0) {
|
if (position >= 0) {
|
||||||
// Found swap idx,position
|
// Found swap idx,position
|
||||||
DoricViewNode *reused = mChildNodes.at(position);
|
|
||||||
DoricViewNode *abandoned = mChildNodes.at(idx);
|
|
||||||
mChildNodes.swapItemsAt(position, idx);
|
mChildNodes.swapItemsAt(position, idx);
|
||||||
|
mView->childItems().swapItemsAt(position, idx);
|
||||||
// View swap index
|
|
||||||
reused->getNodeView()->setParentItem(nullptr);
|
|
||||||
int minIndex = qMin(idx, mView->childItems().size());
|
|
||||||
reused->getNodeView()->setParentItem(mView);
|
|
||||||
reused->getNodeView()->stackBefore(
|
|
||||||
mView->childItems().at(minIndex));
|
|
||||||
|
|
||||||
abandoned->getNodeView()->stackBefore(
|
|
||||||
mView->childItems().at(position));
|
|
||||||
} else {
|
} else {
|
||||||
// Not found,insert
|
// Not found,insert
|
||||||
DoricViewNode *newNode = DoricViewNode::create(getContext(), type);
|
DoricViewNode *newNode = DoricViewNode::create(getContext(), type);
|
||||||
@ -95,12 +88,16 @@ void DoricGroupNode::configChildNode() {
|
|||||||
newNode->setId(id);
|
newNode->setId(id);
|
||||||
newNode->init(this);
|
newNode->init(this);
|
||||||
newNode->blend(model.property("props"));
|
newNode->blend(model.property("props"));
|
||||||
mChildNodes.insert(idx, newNode);
|
|
||||||
|
|
||||||
int minIndex = qMin(idx, mView->childItems().size());
|
if (idx >= mChildNodes.size()) {
|
||||||
newNode->getNodeView()->setParentItem(mView);
|
mChildNodes.append(newNode);
|
||||||
newNode->getNodeView()->stackBefore(
|
newNode->getNodeView()->setParentItem(mView);
|
||||||
mView->childItems().at(minIndex));
|
} else {
|
||||||
|
mChildNodes.insert(idx, newNode);
|
||||||
|
newNode->getNodeView()->setParentItem(mView);
|
||||||
|
newNode->getNodeView()->stackBefore(
|
||||||
|
mView->childItems().at(idx));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -112,11 +109,15 @@ void DoricGroupNode::configChildNode() {
|
|||||||
newNode->setId(id);
|
newNode->setId(id);
|
||||||
newNode->init(this);
|
newNode->init(this);
|
||||||
newNode->blend(model.property("props"));
|
newNode->blend(model.property("props"));
|
||||||
mChildNodes.append(newNode);
|
|
||||||
|
|
||||||
int minIndex = qMin(idx, mView->childItems().size());
|
if (idx >= mChildNodes.size()) {
|
||||||
newNode->getNodeView()->setParentItem(mView);
|
mChildNodes.append(newNode);
|
||||||
newNode->getNodeView()->stackBefore(mView->childItems().at(minIndex));
|
newNode->getNodeView()->setParentItem(mView);
|
||||||
|
} else {
|
||||||
|
mChildNodes.insert(idx, newNode);
|
||||||
|
newNode->getNodeView()->setParentItem(mView);
|
||||||
|
newNode->getNodeView()->stackBefore(mView->childItems().at(idx));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user