|
|
|
@ -33,6 +33,7 @@ PixelPath LayerWrapper::getCache()
|
|
|
|
|
LayerWrapper::LayerWrapper(QJsonObject json, FolderLayerWrapper*parent)
|
|
|
|
|
{
|
|
|
|
|
this->parent = parent;
|
|
|
|
|
this->qTreeWidgetItem = new QTreeWidgetItem();
|
|
|
|
|
auto transformJson = json.value("transform").toObject();
|
|
|
|
|
property.name = json.value("name").toString();
|
|
|
|
|
property.offset = {transformJson.value("offset").toObject().value("x").toDouble(),
|
|
|
|
@ -119,22 +120,22 @@ void LayerWrapper::setParent(FolderLayerWrapper* newParent)
|
|
|
|
|
void FolderLayerWrapper::removeAllChild()
|
|
|
|
|
{
|
|
|
|
|
children.clear();
|
|
|
|
|
qTreeWidgetItem.takeChildren();
|
|
|
|
|
qTreeWidgetItem->takeChildren();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LayerWrapper::del() {
|
|
|
|
|
qDebug() << "LayerWrapper::del()";
|
|
|
|
|
if (parent != nullptr){
|
|
|
|
|
qTreeWidgetItem.takeChildren();
|
|
|
|
|
parent->qTreeWidgetItem.removeChild(&qTreeWidgetItem);
|
|
|
|
|
qTreeWidgetItem->takeChildren();
|
|
|
|
|
parent->qTreeWidgetItem->removeChild(qTreeWidgetItem);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LayerWrapper::delSelf() {
|
|
|
|
|
qDebug() << "LayerWrapper::delSelf()";
|
|
|
|
|
if (parent != nullptr) {
|
|
|
|
|
qTreeWidgetItem.takeChildren();
|
|
|
|
|
parent->qTreeWidgetItem.removeChild(&qTreeWidgetItem);
|
|
|
|
|
qTreeWidgetItem->takeChildren();
|
|
|
|
|
parent->qTreeWidgetItem->removeChild(qTreeWidgetItem);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -154,7 +155,7 @@ void FolderLayerWrapper::delSelf() {
|
|
|
|
|
qDebug() << this;
|
|
|
|
|
for (auto& child : this->children) {
|
|
|
|
|
this->parent->addChild(child);
|
|
|
|
|
this->parent->qTreeWidgetItem.addChild(&child.get()->qTreeWidgetItem);
|
|
|
|
|
this->parent->qTreeWidgetItem->addChild(child.get()->qTreeWidgetItem);
|
|
|
|
|
child->setParent(this->parent);
|
|
|
|
|
}
|
|
|
|
|
while (!this->children.empty()) {
|
|
|
|
@ -166,18 +167,18 @@ void FolderLayerWrapper::delSelf() {
|
|
|
|
|
|
|
|
|
|
QTreeWidgetItem* LayerWrapper::getQTreeItem()
|
|
|
|
|
{
|
|
|
|
|
this->qTreeWidgetItem.setText(0, this->property.name);
|
|
|
|
|
this->qTreeWidgetItem.setData(0, Qt::UserRole, QVariant::fromValue(this));
|
|
|
|
|
return &this->qTreeWidgetItem;
|
|
|
|
|
this->qTreeWidgetItem->setText(0, this->property.name);
|
|
|
|
|
this->qTreeWidgetItem->setData(0, Qt::UserRole, QVariant::fromValue(this));
|
|
|
|
|
return this->qTreeWidgetItem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QTreeWidgetItem* FolderLayerWrapper::getQTreeItem()
|
|
|
|
|
{
|
|
|
|
|
while (this->qTreeWidgetItem.childCount() > 0) {
|
|
|
|
|
this->qTreeWidgetItem.removeChild(this->qTreeWidgetItem.child(0));
|
|
|
|
|
while (this->qTreeWidgetItem->childCount() > 0) {
|
|
|
|
|
this->qTreeWidgetItem->removeChild(this->qTreeWidgetItem->child(0));
|
|
|
|
|
}
|
|
|
|
|
for (auto& child : this->children) {
|
|
|
|
|
this->qTreeWidgetItem.addChild(child->getQTreeItem());
|
|
|
|
|
this->qTreeWidgetItem->addChild(child->getQTreeItem());
|
|
|
|
|
}
|
|
|
|
|
return LayerWrapper::getQTreeItem();
|
|
|
|
|
}
|
|
|
|
|