fix size of splits not loading properly (#2554)
This commit is contained in:
@@ -502,9 +502,6 @@ void WindowManager::encodeNodeRecursively(SplitNode *node, QJsonObject &obj)
|
||||
QJsonArray filters;
|
||||
encodeFilters(node->getSplit(), filters);
|
||||
obj.insert("filters", filters);
|
||||
|
||||
obj.insert("flexh", node->getHorizontalFlex());
|
||||
obj.insert("flexv", node->getVerticalFlex());
|
||||
}
|
||||
break;
|
||||
case SplitNode::HorizontalContainer:
|
||||
@@ -524,6 +521,9 @@ void WindowManager::encodeNodeRecursively(SplitNode *node, QJsonObject &obj)
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
obj.insert("flexh", node->getHorizontalFlex());
|
||||
obj.insert("flexv", node->getVerticalFlex());
|
||||
}
|
||||
|
||||
void WindowManager::encodeChannel(IndirectChannel channel, QJsonObject &obj)
|
||||
|
||||
@@ -412,6 +412,11 @@ Split *SplitContainer::getTopRightSplit(Node &node)
|
||||
|
||||
void SplitContainer::layout()
|
||||
{
|
||||
if (this->disableLayouting_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// update top right split
|
||||
auto topRight = this->getTopRightSplit(this->baseNode_);
|
||||
if (this->topRight_)
|
||||
@@ -702,7 +707,10 @@ void SplitContainer::applyFromDescriptor(const NodeDescriptor &rootNode)
|
||||
{
|
||||
assert(this->baseNode_.type_ == Node::EmptyRoot);
|
||||
|
||||
this->disableLayouting_ = true;
|
||||
this->applyFromDescriptorRecursively(rootNode, &this->baseNode_);
|
||||
this->disableLayouting_ = false;
|
||||
this->layout();
|
||||
}
|
||||
|
||||
void SplitContainer::applyFromDescriptorRecursively(
|
||||
@@ -769,6 +777,13 @@ void SplitContainer::applyFromDescriptorRecursively(
|
||||
{
|
||||
Node *_node = new Node();
|
||||
_node->parent_ = node;
|
||||
|
||||
if (auto *n = std::get_if<ContainerNodeDescriptor>(&item))
|
||||
{
|
||||
_node->flexH_ = n->flexH_;
|
||||
_node->flexV_ = n->flexV_;
|
||||
}
|
||||
|
||||
node->children_.emplace_back(_node);
|
||||
this->applyFromDescriptorRecursively(item, _node);
|
||||
}
|
||||
|
||||
@@ -250,6 +250,7 @@ private:
|
||||
Node baseNode_;
|
||||
Split *selected_{};
|
||||
Split *topRight_{};
|
||||
bool disableLayouting_{};
|
||||
|
||||
NotebookTab *tab_;
|
||||
std::vector<Split *> splits_;
|
||||
|
||||
Reference in New Issue
Block a user